Information Technology Reference
In-Depth Information
outputs only merge commits, while
$ git log --oneline --no-merges
prints only non-merge commits. You also can set the expected minimal and maximal
number of parents with:
$ git log --oneline --max-parents=X --min-parents=Y
where
X
and
Y
are arbitrary positive integers.
Git supports references that allow it to pick up any of the parents for a merge com-
mit using the caret (^) sign. The reference
[REVISION]^[n]
points to the n-th par-
the
master^1
points to the revision
m5
; the
master^2
points to the revision
f3
, as
illustrated in
Figure 6-10
. I will refer to them as
n-th parent references
.
Figure 6-10
.
N-th parent references master^1 and master^2
Remember that the references
[REVISION]
∼
,
[REVISION]
∼
1
,
[REVISION]^
,
and
[REVISION]^1
are equivalent. This is because
1
is a default value and
∼
always
references the first parent in merge commits.
If you want to use the
$ git merge
command with confidence, you have to re-
member that
the current branch is the branch you merge into
, and
the branch
passed to $ git merge command is the branch to be merged in
. The tip of the branch
you merge into (
master
branch) becomes the first parent of a merge commit and the
tip of the branch you merge in (
feature
branch) becomes the second parent. The