I am having troubles with git's reflog command. Reading the official documentation I got the impression that, main being a local branch where you committed a few times, you could for example call git reflog show main@{1} or its equivalent git reflog main@{1} to show the second-to-last commit in the main branch, and that the same thing should apply to HEAD.
If I try to do that, even on a fresh repo with just three commits
$ git reflog main 8a0a764 (HEAD -> main) main@{0}: commit: third commit 44b44f1 main@{1}: commit: second commit b869f71 main@{2}: commit (initial): first commit I get the following error:
fatal: ambiguous argument 'main@': unknown revision or path not in the working tree. Use '--' to separate paths from revisions, like this: 'git <command> [<revision>...] -- [<file>...]' What am I missing?
ETA: I was using a Windows 10 machine with default Windows Terminal shell (PowerShell), and using quotes as suggested seems to have solved the problem.
ambiguous argument 'main@':) seems to suggest that something is eating the{0}part of your expression. Can you give us more details no just about the command you ran, but about the environment in which you're running it?"main@{1}"