References - GradedJestRisk/git-training GitHub Wiki
List:
- HEAD
@
, eg. git checkout @ = git checkout HEAD - upstream branch
REF@{u}
orREF@{upstream}
, eg@{u}
is current branch upstream - parent commit
^
, eg C0-> C1 -> C2 <- HEAD, HEAD^ is C1, @^ is C1, @^^ is C0 (it accepts a number, but usually tile is prefered: @^1 is C1 , HEAD^^ is C0, HEAD^2 is C0) - nth parent
~<n>
, eg C0-> C1 -> C2 <- HEAD, @~2 is C0
- "the n-th prior value of that ref"
REFERENCE@{N}
: master@{1} is the commit pointed by master, on the previous change (eg. on branch master pointing to C1 - git commit create C2: master{0} is C2, master{1} is C1)
- ancestors:
r1
means all r1 ancestors, including r1 - interval:
-
^r1 r2
means all commits between r1 and r2, excluding r1, eg ] r1; r2 ] -
r1..r2
is shorthand for^r1 r2
, eg ] r1; r2 ]
-
- non-intersection:
r1...r2
: all commits reachable from r1 or r2, but not both
G H I J \ / \ / D E F \ | / \ \ | / | \|/ | B C \ / \ / A Args Expanded arguments Selected commits D G H D D F G H I J D F ^G D H D ^D B E I J F B ^D B C E I J F B C C I J F C B..C = ^B C C B...C = B ^F C G H D E B C
Using symbols
B^- = B^..B = ^B^1 B E I J F B C^@ = C^1 = F I J F B^@ = B^1 B^2 B^3 = D E F D G H E F I J C^! = C ^C^@ = C ^C^1 = C ^F C B^! = B ^B^@ = B ^B^1 ^B^2 ^B^3 = B ^D ^E ^F B F^! D = F ^I ^J D G H D F
More with git help revisions
Get nearest ancestor not on branch (aka parent) with this gist
All these are equivalent
origin/master remotes/origin/master refs/remotes/origin/master
See API