On Boarding doc set> EB PRIME MINISTER
op
Git provides various ways to reference specific commits within a repository.
Direct References:
- SHA-1 Hash: The full 40-character SHA-1 hash (e.g.,
ca82a6dff817ec66f44342007202690a93763949) uniquely identifies a commit. A shorter, unique prefix of the hash can also be used, but the full hash is recommended for stability. - Branch Name: The name of a branch (e.g.,
master,feature/new-feature) refers to the commit at the tip of that branch. - Tag Name: The name of a tag (e.g.,
v1.0.0) refers to the commit the tag points to.
Relative References:
- HEAD: Refers to the commit currently checked out in your working directory.
- HEAD~N (tilde notation): Refers to the Nth ancestor of the current commit, following the first parent in the case of merge commits. For example,
HEAD~1is the parent,HEAD~2is the grandparent. - HEAD^N (caret notation): Refers to a specific parent of a merge commit.
HEAD^orHEAD^1refers to the first parent, whileHEAD^2refers to the second parent (useful for navigating merge history). - Branch..Other_Branch (two-dot notation): Represents the commits reachable from
Other_Branchbut not fromBranch. This is often used forgit logto show changes introduced in one branch relative to another. For example,origin/master..HEADshows commits on your current branch that are not onorigin/master. - Branch…Other_Branch (three-dot notation): Represents the commits reachable from either
BranchorOther_Branchbut not from their common merge base. This shows the symmetric difference between the two branches.