$ git show @{1} # uses reflog for current branch
$ git show master@{1} # uses reflog for branch 'master'
$ git show HEAD@{1} # uses 'HEAD' reflog
A ref, usually a branch or HEAD, followed by the suffix @
with an ordinal specification enclosed in a brace pair (e.g. {1}
, {15}
) specifies the n-th prior value of that ref in your local repository. You can check recent reflog entries with git reflog
command, or --walk-reflogs
/ -g
option to git log
.
$ git reflog
08bb350 HEAD@{0}: reset: moving to HEAD^
4ebf58d HEAD@{1}: commit: gitweb(1): Document query parameters
08bb350 HEAD@{2}: pull: Fast-forward
f34be46 HEAD@{3}: checkout: moving from af40944bda352190f05d22b7cb8fe88beb17f3a7 to master
af40944 HEAD@{4}: checkout: moving from master to v2.6.3
$ git reflog gitweb-docs
4ebf58d gitweb-docs@{0}: branch: Created from master
Note: using reflogs practically replaced older mechanism of utilizing ORIG_HEAD
ref (roughly equivalent to HEAD@{1}
).