What does a revision like `HEAD~2`, `HEAD^2`, `main@{yesterday}` or `:/fix` mean?
IntermediateConceptGit internals: objects, refs and the index
Answer
~N follows first parents N times. ^N selects the Nth parent of a merge commit (HEAD^2 is the merged-in side). @{time} and @{N} use the reflog, so they are local. :/text finds the youngest reachable commit whose message matches. A..B is commits in B not in A, A...B is the symmetric difference.
git log main..feature
git show :/"fix login"
More on Git internals: objects, refs and the index
What are the four object types in Git's object database?BeginnerIs Git a snapshot system or a diff system?BeginnerWhat is the SHA-1 (or SHA-256) hash of an object and how is it computed?BeginnerWhere does Git store objects on disk, and what are loose objects versus packfiles?IntermediateWhat exactly is a branch, and what does creating one cost?IntermediateWhat is HEAD?Beginner