简体   繁体   English

当另一个分支合并到一个分支中时,如何查找更改的文件(忽略合并分支中的更改)?

[英]How to find the files changed in one branch when another has been merged into it (ignoring changes from the merged branch)?

I have been working on a feature with a few colleagues on a branch "b1", this work has gone on over a few months and somebody decided to merge in the changes from master to try and reduce the possibility of merge conflicts further down the line. 我一直在与“ b1”分支上的几个同事一起开发功能,这项工作已经进行了几个月,有人决定合并master的更改,以尝试减少合并冲突的可能性。

|
|\  
| \
|  \   (branch point)
|   |
|   |
|   |
|___|    (merge)
|   |
|   |
|   |    (current state)
    (b1)

Work had been ongoing on master before it was merged into b1. 在母版合并到b1中之前,它一直在进行中。 I would like to know what files have been changed ONLY in b1, ignoring all of the commits which are now in the history of b1 which were brought in by merging master in. 我想知道b1中仅更改了哪些文件,而忽略了b1历史中由master合并带来的所有提交。

I have tried using various git log options to do so such as the --no-merges option, which seems to only ignore the actual merge commits. 我尝试使用各种git log选项来执行此操作,例如--no-merges选项,该选项似乎只忽略实际的合并提交。

I have also tried to simply find the files changed by each of us in the history using a command like so: 我还试图使用如下命令简单地找到我们每个人在历史记录中更改的文件:

git log --no-merges --author="Jeff" --name-only --pretty=format:"" <branch_point>..HEAD 

However, as we have all done work which was in master at the time of merge, it is not clear what has been changed in which branch. 但是,由于我们都完成了合并时在母版中所做的工作,因此不清楚在哪个分支中进行了哪些更改。

Is there a nice, clean way to find out the files changed only in b1? 有没有一种很好的,干净的方法来找出在b1中更改过的文件? Any help would be much appreciated. 任何帮助将非常感激。

Assuming there are no conflicts, git diff master...b1 (ie triple dot). 假设没有冲突, git diff master...b1 (即三点)。

That's not so well defined in a common case. 在通常情况下,定义不太好。 I guess one of the meaningful ways it to merge master into b1 again and then diff the merge result with the master. 我猜想它再次将master合并到b1,然后将合并结果与master进行diff的一种有意义的方式。 In this case it will show meaningful difference with all conflicts/inconsistencies solved by the merge. 在这种情况下,它将显示合并所解决的所有冲突/不一致的有意义的差异。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Git - 如何查看分支是否已合并到另一个分支? - Git - How to see if a branch has EVER been merged into another branch? 如何查找分支是否已合并到任何分支(不仅是特定分支) - How do I find if a branch has been merged to any branch (not just a specific one) 如何重做已经合并到另一个分支中的提交 - How to rework a commit that has already been merged in an another branch 查找分支何时合并 - Find when a branch was merged 该(重新设置的)分支是否已合并? - Has this (rebased) branch been merged? 如何仅将过去分支中的更改文件合并到GIT中的主文件中? - How to merged only changed files from a past branch into the master in GIT? 如何判断给定git分支的最后一次提交合并到另一个分支中,以查找对该分支所做的更改? - How to tell the last commit of a given git branch merged into another branch to find changes made on the branch? 如何从一个git分支中删除已合并到另一个分支的提交 - How to remove commits from one git branch that have been merged into another 如何检查分支是否已合并到另一个分支? - How can I check whether a branch has been merged into another branch? 当多个分支合并到开发中时,如何仅回滚开发中的一个分支 - How to rollback only one branch from development when multiple branches have been merged on it
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM