I "accidentally" pushed a commit to github.
Is it possible to remove this commit?
I want to revert my github repository as it was before this commit.
I "accidentally" pushed a commit to github.
Is it possible to remove this commit?
I want to revert my github repository as it was before this commit.
First, remove the commit on your local repository. You can do this using git rebase -i
. For example, if it's your last commit, you can do git rebase -i HEAD~1
and delete the first line.
Then, force push using git push origin +master
.
See http://www-cs-students.stanford.edu/~blynn/gitmagic/ch05.html#_8230_and_then_some for more information.
Oh, and if your working tree is dirty, you might want to do a git stash
first, and a git stash apply
after.
you probably want to check out http://stackoverflow.com/questions/443896/removing-code-from-github