Saturday, 25 April 2015

Git being a git.

I needed to revert a commit I made.

So....

$ git revert 83720d9ddad4d1021e3cf0b416ebd7a761771cae
Please supply the message using either -m or -F option.

$ git revert 83720d9ddad4d1021e3cf0b416ebd7a761771cae -m "Revert mistaken approach"
error: switch `m' expects a numerical value

$ git revert -m "Revert mistaken approach" 83720d9ddad4d1021e3cf0b416ebd7a761771cae
error: switch `m' expects a numerical value

(writes logmesg file...)

$git revert 83720d9ddad4d1021e3cf0b416ebd7a761771cae -F logmesg
fatal: bad revision 'logmesg'

$ git revert -F logmesg 83720d9ddad4d1021e3cf0b416ebd7a761771cae 
fatal: bad revision 'logmesg'

Grrr.

All that was needed was to simply: 

$ git revert 83720d9ddad4d1021e3cf0b416ebd7a761771cae
$ git commit -a -m "Revert mistaken approach"

Moral: Don't believe everything you read.  Especially not error messages.