Remove last commit from remote git repository [duplicate]
Possible Duplicate:
Rolling back local and remote git repository by 1 commit
How can I remove the last commit from a remote GIT repository such as I don't see it any more in the log?
If for example git log
gives me the following commit history
A->B->C->D[HEAD, ORIGIN]
how can I go to
A->B->C[HEAD,ORIGIN]
Thanks.
Be careful that this will create an "alternate reality" for people who have already fetch/pulled/cloned from the remote repository. But in fact, it's quite simple:
git reset HEAD^ # remove commit locally
git push origin +HEAD # force-push the new HEAD commit
If you want to still have it in your local repository and only remove it from the remote, then you can use:
git push origin +HEAD^:<name of your branch, most likely 'master'>
If nobody has pulled it, you can probably do something like
git push remote +branch^1:remotebranch
which will forcibly update the remote branch to the last but one commit of your branch.