Git Reference
Git Reference / Revision syntax

22Revision syntax

Ways to name a commit anywhere Git expects one.

SyntaxMeaning
HEADThe current commit
HEAD~3Three commits back along first parents
HEAD^2The second parent of a merge commit
main@{upstream} / @{u}The branch’s upstream (e.g. origin/main)
main@{2.days.ago}Where main pointed two days ago (reflog)
A..BCommits in B not in A (“what’s new on B”)
A...BCommits in either but not both; in diff, changes since the merge-base
:/fix loginMost recent commit whose message matches
v1.0:src/app.jsA file’s contents at a revision