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.
In GitHub Desktop you can just right click the commit and revert it, which will create a new commit that undoes the changes.
The accidental commit will still be in your history (which may be an issue if, for instance, you've accidentally commited an API key or password) but the code will be reverted.
This is the simplest and easiest option, the accepted answer is more comprehensive.
Run this command on your terminal.
You can remove the last n commits from local repo e.g. HEAD~2. Proceed with force git push on your repository.
Hope this helps!
That should "undo" the push.
You need to know your commit hash from the commit you want to revert to. You can get it from a GitHub URL like: https://github.com/your-organization/your-project/commits/master
Let's say the hash from the commit (where you want to go back to) is "99fb454" (long version "99fb45413eb9ca4b3063e07b40402b136a8cf264"), then all you have to do is:
Delete the most recent commit, keeping the work you've done:
Delete the most recent commit, destroying the work you've done:
You'll need to clear out your cache to have it completely wiped. this help page from git will help you out. (it helped me) http://help.github.com/remove-sensitive-data/