【问题标题】:Git: Is there a quick way to see when was the last time that git merge master was done on the current working branch?Git:有没有一种快速的方法可以查看上一次在当前工作分支上完成 git merge master 是什么时候?
【发布时间】:2011-12-30 19:03:14
【问题描述】:

我通常在与 master 不同的分支上工作。所以当我在开发东西时,我会偶尔执行git merge master。有时我想知道最后一次是什么时候,我在那个分支上做了git merge master。我知道我可以做git log 并寻找“合并分支'master'”,并查看提交的日期......但如果有魔法,我想知道!

【问题讨论】:

    标签: git merge git-merge


    【解决方案1】:

    您可以使用git merge-base 获取共同祖先,并显示结果。

    类似这样的:

    git merge-base HEAD master | git show --pretty

    【讨论】:

      【解决方案2】:
      git show :/"Merge branch 'master'"
      

      【讨论】:

      • 有趣,我不知道 rev-parse 理解正则表达式。我将在未来使用它(虽然不是为了这个:) 只是为了替换一些 git log --grep 样式搜索)
      【解决方案3】:

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

      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
      

      命名将要合并的base修订版来自


      注意事项:

      --cherry-pick 
      

      当提交集受到对称差异的限制时,忽略与“另一侧”上的另一个提交引入相同更改的任何提交。

      例如,如果您有两个分支 A 和 B,则仅列出其中一侧的所有提交的常用方法是使用 --left-right,就​​像上面该选项描述中的示例一样。然而,它显示了从另一个分支中挑选出来的提交(例如,“b 上的第 3 次”可能是从分支 A 中挑选出来的)。使用此选项,此类提交对将从输出中排除。

      【讨论】:

        猜你喜欢
        • 2015-06-30
        • 2012-03-03
        • 1970-01-01
        • 2011-06-11
        • 2014-06-29
        • 1970-01-01
        • 2020-05-02
        • 1970-01-01
        • 2015-07-30
        相关资源
        最近更新 更多