I was reading about the difference in using a ~ vs ^ operator in git and I came across this question What's the difference between HEAD^ and HEAD~ in Git?
The one thing I could not find a good explanation for online after googling is how does git distinguish the first parent of a merge commit from the second one?
Is there a rule of thumb?
Take this example where a feature branch is merged into the develop branch, creating the merge commit G.
develop feature/foo
A D
| |
B E
| |
C F
\ /
G <- develop(HEAD)
Which one is the first parent of G? C or F? Why is it the first parent?
NOTE: This is not a request for the git command to determine the first or the second parent. I'm aware that it can be achieved using git show G^1 and git show G^2. I see that C is the first parent of G and F is the second parent. But, I do not understand why that is the case. Is it like the branch on which the merge commit is made determines the first parent?