HEAD~ vs HEAD^ vs HEAD@{} also known as tilde vs caret vs at sign

HEAD is a pointer at the current branch. I have seen a variety of notations for ancestors of HEAD including

  • HEAD~2
  • HEAD^2
  • HEAD@{2}
  • HEAD~~
  • HEAD^^

What does each of the above mean, exactly? Where is the documentation for this?

  • Want git post receive hook to make new commit and push
  • How do I restrict Apache/GIT access to specific users (ldap/file-based authentication)?
  • GIT Weekly Activity
  • how to update submodule url in all commits
  • Can any source control system handle branching code base on a per client basis?
  • Git Clone Failure
  • What is the difference between --parameter and -parameter?
  • Storing submodules for micro services, but still using forks
  • Python subprocess “git gc” stderr is not captured
  • git merge conflict saying deleted, but it's not
  • git cherry-pick merge conflict pulling in other commits?
  • Egit working directory vs. projects in Eclipse
  • One Solution collect form web for “HEAD~ vs HEAD^ vs HEAD@{} also known as tilde vs caret vs at sign”

    • HEAD~2 : 2 commits older than HEAD
    • HEAD^2 : the second parent of HEAD, if HEAD was a merge, otherwise illegal
    • HEAD@{2} : refers to the 3rd listing in the overview of git reflog
    • HEAD~~ : 2 commits older than HEAD
    • HEAD^^ : 2 commits older than HEAD

    Documentation can be found here.

    Git Baby is a git and github fan, let's start git clone.