When git commit has multiple parents, what are the statistics counted against?

When a commit has several parents, for example this one , we see that it has 4 additions and 4 deletions . My question compared to what? Are additions and deletions compared to the file, as was the case with both parents? Or how exactly does this compare?

+5
source share
1 answer

This is a three way merger between:

  • the common ancestor of both parents ( git merge-base @^1 @^2 , ^1 is the first parent, ^2 is the second parent of HEAD: see the Ancestral Reference ".)
  • second parent ( commit c0ce149 ) acting as the source (merge)
  • first parent ( commit 0994e7c ) acting as the recipient (located on the branch where the merge occurs)
  • with HEAD ( commit 4cd713e ) resulting from the merge.

(you can see another example of triangular merge in this answer )

By convention, GitHub will always display parents as:

  • The first parent, which is the branch you were included on when you merged,
  • and the second parent element, which is a commit on the branch you merged into.

Compared to the common ancestor of these two commits, the second, when combined with the first, brings 4 additions and 4 deletions.

+8
source

Source: https://habr.com/ru/post/1200676/


All Articles