Let say I have a branch on my local A
and this is exist in remote as well origin/A
. Both my local and remote branch is in sync. For example in local I have commit like - C1
, C2
, C3
and C4
and same in my remote as well.
Now I want to revert the change that I commit for C4
. I already pushed this to remote, so I want to do that in remote as well.
NOTE: I found lot of question in stackoverflow for this. Here is one. But it's not working for me!
As per this I tried:
git reset --hard HEAD~1
git push -f origin A
First command works fine and my local version does not have the C4
commit now.
Problem is in the second command. It showing remote: error: denying non-fast-forward refs/heads/A (you should pull first)
.
How to solve this issue?