If you want to change the history of remote branches destructively (e.g. rebase / amend ), make your changes locally and then do git push --force . Sometimes this does not work (repository administrators can disable this feature); in this case, you can try to delete the remote branch using git push origin :my_branch and then click it again with git push origin my_branch . Otherwise, you can use git revert , which is recommended if you are working in a team (the rule of thumb is that the published story should not be changed).
Here is an example (using this Github repository ):
$ touch SOMETHING $ emacs SOMETHING $ git add SOMETHING $ git ci -m SOMETHING [master d14aaa0] SOMETHING 1 files changed, 1 insertions(+), 0 deletions(-) create mode 100644 SOMETHING $ git push Counting objects: 8, done. Compressing objects: 100% (5/5), done. Writing objects: 100% (6/6), 611 bytes, done. Total 6 (delta 3), reused 0 (delta 0) To git@github.com:23Skidoo/ghc-parmake.git 53f836a..d14aaa0 master -> master $ git reset --hard "HEAD~" HEAD is now at 7b2dc96 TODO update. $ git push --force Total 0 (delta 0), reused 0 (delta 0) To git@github.com:23Skidoo/ghc-parmake.git + d14aaa0...7b2dc96 master -> master (forced update)
Looking at the commit history , you can see that commit d14aaa0 is missing.
Mikhail Glushenkov
source share