git reset HEAD~1
I was under the impression that the ~1 meant: start at the HEAD, follow 1 link, and set the HEAD tag to that new commit node. I was expecting
git reset HEAD~2
to follow 2 links and then set the HEAD tag. However, if I try it, I get an error:
$ git reflog
c83bbda HEAD@{0}: reset: moving to HEAD~1
44c3540 HEAD@{1}: commit: you will be garbage soon
c83bbda HEAD@{2}: reset: moving to HEAD~1
aee7955 HEAD@{3}: commit: back to 4 lines
c83bbda HEAD@{4}: reset: moving to HEAD~1
19ec1d5 HEAD@{5}: commit: 3 lines
c83bbda HEAD@{6}: reset: moving to HEAD~1
a049538 HEAD@{7}: commit: added new line
c83bbda HEAD@{8}: commit (initial): first commit
$ git reset --hard HEAD~2
fatal: ambiguous argument 'HEAD~2': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
Apparently I was mistaken, but the doc page for git reset is not very useful in clarifying this. So, what does the ~1 mean and why do I need it?