Git:是否有一种快速的方法来查看在当前工作分支上最后一次完成git合并主分支的时间?

7

通常我会在一个与主分支不同的分支上工作。因此,在开发过程中,我会时不时地执行git merge master。有时候我想知道上一次在该分支上执行git merge master是什么时候。我知道可以执行git log并查找“Merge branch 'master'”来查看提交的日期......但如果有一个魔法,我想知道它是什么!

3个回答

8
git show :/"Merge branch 'master'"

有趣,我不知道 rev-parse 理解正则表达式。将来我会用它(虽然不是为了这个 :) 只是为了替换一些 git log --grep 风格的搜索) - sehe

4

我个人喜欢检查修订树中的差异:

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

命名将从中合并的基础修订版本


注:

--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.


2
你可以使用git merge-base来获取共同的祖先,并显示结果。
类似这样: git merge-base HEAD master | git show --pretty

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接