As illustrated by this thread, in a VCS based on history represented by a DAG (Directed Acyclic Graph), there is not "one parent" or "one child".
C1 -> C2 -> C3
/ \
A -> B E -> F
\ /
D1 -> D2 ----/
The ordering of commits is done by "topo-order" or "date-order" (see GitPro book)
But since Git1.6.0, you can list the children of a commit.
git rev-list --children
git log --children
Note: for parent commits, you have the same issue, with the suffix ^
to a revision parameter meaning the first parent of that commit object. ^<n>
means the <n>
th parent (i.e. rev^
is equivalent to rev^1
).
If you are on branch foo
and issue "git merge bar
" then foo
will be the first parent.
I.e: The first parent is the branch you were on when you merged, and the second is the commit on the branch that you merged in.