Consider
$ git merge-base <original-branch> <new-branch>
Question: is git merge-base
commutative? That is, does the above command yield the same result as
$ git merge-base <new-branch> <original-branch>
If there is only one merge-base, then yes.
Meaning: git merge-base --all <original-branch> <new-branch>
returns only one commit.
But, as mentioned in the git merge-base
man page:
When the history involves criss-cross merges, there can be more than one best common ancestor for two commits.
For example, with this topology:
---1---o---A
\ /
X
/ \
---2---o---o---B
both 1 and 2 are merge-bases of
A
andB
. Neither one is better than the other (both are best merge bases).
When the--all
option is not given, it is unspecified which best one is output.
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