From the documentation for git-rev-parse:
^, e.g. HEAD^, v1.5.1^0
A suffix ^ to a revision parameter means the first parent of that commit object. ^<n> means the <n>th parent (i.e. <rev>^ is equivalent to <rev>^1). As a special rule, <rev>^0 means the commit itself and is used when <rev> is the object name of a tag object that refers to a commit object.
I understand that git commits can have multiple parents, and that this syntax can be used to disambiguate which parent is referred to, but what determines which parent is the 'first parent' or 'second parent'? Is it just based on which commit was checked out when the commits were merged?
For example, would git checkout master; git merge feature result in master being parent 1, whereas git checkout feature; git merge master would result in feature being parent 1? Or is there something else going on here?
Is it just based on which commit was checked out when the commits were merged?
That's right. You can look at the parents of a commit using git show or git cat-file -p HEAD.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With