Remove last commit from remote Git repository
# remove commit locally
git reset HEAD^
# only remove it from the remote
# deprecated
git push origin +HEAD^:"$name_of_your_branch" # e.g. +HEAD^:master
# new
git push origin +HEAD~:refs/heads/$name_of_your_branch
# new
git push origin +HEAD~:refs/heads/$name_of_your_branch
# e.g. git push origin +HEAD~:refs/heads/master
# Some shells interpret the ^ character. For those shells, either quote/escape or use ~
HEAD\^
'HEAD^'
HEAD~
Comments
Post a Comment