[英]List changes in master since a branch was created
A branch, called mil-1
(for milestone) was created from master some time ago. 不久前从master创建了一个名为
mil-1
(代表里程碑)的分支。 There have been changes to master since this branch was created. 自创建该分支以来,master发生了更改。 I need to review them and merge some of them into the milestone branch.
我需要对其进行审查,并将其中一些合并到里程碑分支中。
After running git fetch --all
, git log refs/heads/master
lists the changes in master; 运行
git fetch --all
, git log refs/heads/master
列出git log refs/heads/master
中的更改; and I know how to restrict them to a certain number of commits: 而且我知道如何将它们限制为一定数量的提交:
$ git log -1 origin/master
commit 5401cc7edf382183537a011632c422a491faea5b
Author: ********
Date: Wed May 28 18:29:59 2014 +0530
But how do I restrict the output to only to commits done after the mil-1
branch was created? 但是,如何将输出限制为仅创建
mil-1
分支之后完成的提交?
Assuming that mil-1
hasn't been updated with the new commits made to master
, then this is done using a simple commit range: 假设尚未使用对
master
的新提交来更新mil-1
,那么可以使用简单的提交范围来完成此操作:
git log mil-1..origin/master
will show you all commits that exist in the origin/master
that don't yet exist in mil-1
. 将向您显示在
mil-1
还不存在的所有在origin/master
中的提交。
See also Pro Git § 6.1 Git Tools - Revision Selection: Commit Ranges . 另请参阅Pro Git§6.1 Git工具-版本选择:提交范围 。
But how do I restrict the output to only to commits done after the
mil-1
branch was created?但是,如何将输出限制为仅创建
mil-1
分支之后完成的提交?
First you can use git merge-base
to find the most recent commit the two branches have in common (which in your case is probably the commit that the branch was created from): 首先,您可以使用
git merge-base
查找两个分支共同拥有的最新提交(在您的情况下,可能是创建分支的提交):
mergebase=$( git merge-base master mil-1 )
Then you can list all commits on the master
branch since then: 然后,您可以在此之后在
master
分支上列出所有提交:
git log $mergebase..master
Alternatively, you get the same result just asking for all commits between mil-1..master
, which tells you all the commits which are in the history of master
but not in the history of mil-1
或者,您只需要在
mil-1..master
之间进行所有提交即可得到相同的结果,它告诉您在master
历史记录中但不在mil-1
历史记录中的所有提交
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.