I returned Scott Weldon's answer , which is correct, but I just want to add a try to ASCII art, which includes parental numbering. Given a graph that looks like this:
B / \ ...
we can say that node D is a merge commit, but we cannot determine if B or C first parent of D One of them is necessarily the first parent, and the second second. Therefore, if we need to know, we must designate a drawing that takes up more space. Here is one such attempt.
B / \² ...
Now we see that, for some reason 1, I plotted the “upside down” graph: this commit C is actually the first parent of D , and commit B is the second parent.
It is possible to create arbitrary mergers using lower-level commands ("plumbing"). In particular, git commit-tree simply accepts any many -p arguments you want to give in the order you give them, and makes a new commit with these commits as its parents. Give him one -p and he will commit normally with one parent. Give it the -p arguments and it will make a root commit. Give it 155 different -p arguments (all should, of course, allow valid commit identifiers), and this makes one massive agreement with osynos.
However, the git merge command always makes its new commit with the first parent being the current HEAD (hence the current branch, if on the branch). The second parent element for the standard two parent merge is from .git/MERGE_HEAD , into which git merge writes a different commit identifier. If the merge conflicts or the final merge is completed with --no-commit , this MERGE_HEAD file is actually the only place where the commit identifier is available.
(When git merge merges octopus using the -s octopus strategy - this strategy is enforced for such mergers and several additional parents, it is interrupted and leaves no traces at all if there are merge conflicts, so a conflict case never occurs. I have not tried combining --no-commit with merging octopuses, but that would logically leave parents 2nd through N'th in MERGE_HEAD if Git allows this at all.)
1 stubbornness.
torek
source share