Git Revert Not Working

Peter Foti picture Peter Foti · Apr 25, 2014 · Viewed 13.6k times · Source

So i've got a develop branch with a commit that I want to revert. So I type in git revert <commit-hash>

But when it runs it says:

$ git revert 165702b305
On branch develop
nothing to commit, working directory clean

This commit has been tracked down as the culprit of a bug and id like to revert it, but for some reason its not working. Could it be corrupted somehow? Other answers and searches have not been able to help.

Answer

sudo picture sudo · Aug 5, 2015

I had the same issue.

Using the following snippet worked for me:

git revert --no-commit <commit-id> -n HEAD