本文介绍了显示分支创建后的提交的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法看到 git log 或其他一些命令只是在分支创建后添加的提交?

Is there a way to see with git log or some other command only the commits that were added after branch creation?

usage: git log [<options>] [<since>..<until>] [[--] <path>...]
   or: git show [options] <object>...

    --quiet               suppress diff output
    --source              show source
    --decorate[=...]      decorate options


推荐答案

在这种情况下,第二个分支与第一个分支不同,或者在这种情况下,您的分支与主分支不同:

Use three periods to reference the commit at which the second branch diverged from the first, or in this case your branch diverged from master:

git log master...<your_branch_name>

确保在这种情况下使用三个句点。

Make sure to use three periods for this case.

注意:您也可以不使用分支名称,因为在这种情况下git会自动引用HEAD指针,例如:

Side-Note: You can also leave off your branch name as git automatically references the HEAD pointer in that case, for example:

git log master...

等同于我之前的例子。这可以在提交比较可用的任何地方进行。

is equivalent to my previous example. This works anywhere a commit comparison is available.

这篇关于显示分支创建后的提交的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-25 06:48