通常我会在一个与主分支不同的分支上工作。因此,在开发过程中,我会时不时地执行git merge master
。有时候我想知道上一次在该分支上执行git merge master
是什么时候。我知道可以执行git log
并查找“Merge branch 'master'”来查看提交的日期......但如果有一个魔法,我想知道它是什么!
git show :/"Merge branch 'master'"
我个人喜欢检查修订树中的差异:
git log --graph --left-right --cherry-pick --oneline branch1...branch2
git show-branch
git show-branch branch1 branch2
git show-branch --all # which does all of the above and more
git merge-base branch1 branch2
命名将从中合并的基础修订版本
注:
branch1
和branch2
--cherry-pick
选项带有一种罕见的魔力
:--cherry-pick
Omit any commit that introduces the same change as another commit on the "other side" when the set of commits are limited with symmetric difference.
For example, if you have two branches, A and B, a usual way to list all commits on only one side of them is with --left-right, like the example above in the description of that option. It however shows the commits that were cherry-picked from the other branch (for example, "3rd on b" may be cherry-picked from branch A). With this option, such pairs of commits are excluded from the output.
git log --grep
风格的搜索) - sehe