I accidently pushed .idea/workspace.xml. and made more push after that.
My code is merged on development branch. My team member asked me to revert .idea/workspace.xml changes.
So I followed:
git revert <commit sha>
git push origin <my branch>
as commit reverted had some changes which i want to persist, therefore copied my changes from development and
git add .
git commit -m'added back changes in filepath'
git push origin mybranch
! [remote rejected] mybranch -> mybranch (pre-receive hook declined) error: failed to push some refs to '[email protected]:reponame/projectname.git'
I tried to find solution on internet but could not figureout. Any help would be appreciated.
I also tried git push with -force flag. but that also did not work.
The message in your text image says:
! [remote rejected] mybranch -> mybranch (pre-receive hook declined)
error: failed to push some refs to '[email protected]:reponame/projectname.git'
The first line contains the phrase pre-receive hook declined
. This means that something that is not part of Git itself is doing some checking on the commits you've asked the Git over at Bitbucket to accept. That thing-that-did-the-checking does not like your commits, for some reason.
Ideally, any pre-receive hook that rejects commits should tell you why it is rejecting the commits. If it did, you should include that in your question. Any messages from such a hook would appear above the ! [remote rejected]
line, prefixed with the word remote:
for each line.
Per your own comment:
I have made last commit without adding JIRA ID which failed a hook
it was a pre-receive check to make sure that each commit contains a JIRA ID.
You will need to replace the bad commit(s) with new-and-improved commit(s) that meet the requirements of your pre-receive hook.