git リセット HEAD~1
~1 は、HEAD から開始し、1 つのリンクをたどり、HEAD タグをその新しいコミット ノードに設定するという意味であるという印象を受けました。私は期待していました
git リセット HEAD~2
2 つのリンクをたどって HEAD タグを設定します。ただし、試してみると、エラーが発生します。
$ 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>...]'
どうやら私は間違っていたようですが、git reset のドキュメント ページはこれを明確にするのにあまり役に立ちません。では、~1 は何を意味し、なぜそれが必要なのですか?