github twitter mastodon linkedin instagram 500px email
Use @ instead of HEAD
Aug 25, 2015
One minute read

I recently discovered that from git version 1.8.5 onwards, @ can replace HEAD:

$ git reset --hard @~2
$ git rebase -i @~10
$ git diff @~2..@~3

And also in most scenarios HEAD can be left out completely, so you can say:

$ git reset -- @{2}

instead of:

$ git reset -- HEAD@{2}

It takes some getting used to, but it’s definitely faster than typing HEAD.


Back to posts


comments powered by Disqus