codyc4321
codyc4321

Reputation: 9672

fatal: bad revision 'HEAD-1 on revert

I want to revert my last commit on a public branch with the commit being pushed up. I wanted to use revert to show what I did wrong and I reverted it, but these instructions are not working:

   cchilders:~/work_projects/webapi (ckc/my-branch) 
    $ git revert HEAD-1
    fatal: bad revision 'HEAD-1'

Upvotes: 0

Views: 1426

Answers (1)

e.doroskevic
e.doroskevic

Reputation: 2169

To consolidate the answer to this question: The reason why you've received an error is due to syntax error.

The correct instruction would be

git revert HEAD~1 

instead

git revert HEAD-1

Upvotes: 2

Related Questions