显示两个 git 分支的对称差异?

Show the symmetric difference of two git branches?

我正在寻找一些方法来获取分支 A 或分支 B 上的所有提交,但不是同时在这两个分支上。

如评论中所述,三点运算符给出了答案。引用 man git-rev-parse:

A similar notation "r1...r2" is called symmetric difference of r1 and r2 and is defined as "r1 r2 --not $(git merge-base --all r1 r2)". It is the set of commits that are reachable from either one of r1 or r2 but not from both.