In a branching model where one branch A is always merged into another B, how can I list all commits in B but not in A while ignoring all cherry-picked commits and merges?
a1-------b2' -- A
/ \ \
b1--b2--m1--b3--m2--b4 -- B
b2': cherry-picked commit
In this case, it should list commits b3, b4.
Some research in the git manual:
Ignoring merges and cherry-picked commits is already addressed by the --no-merges and --cherry-* options of the git-log command. But the --cherry-* ones use the commits symmetric difference (that is A...B) to match cherry-picks together. In this example, commit b2 is not part of it. git log --cherry A...B returns b2, b3, b4.
You can reproduce the example with:
mkdir reprod; cd reprod; git init
git check-out -b B
git commit -m "b1" --allow-empty
git commit -m "b2" --allow-empty
git check-out -b A B^{/b1}
git commit -m "a1" --allow-empty
git cherry-pick --allow-empty B^{/b2}
git check-out B
git merge A^{/a1} --no-edit
git commit -m "b3" --allow-empty
git merge A^{/b2} --no-edit
git commit -m "b4" --allow-empty
git log A...B --cherry