如何做 Git Log 只看到合并到 master 分支?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/25986534/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 02:31:18  来源:igfitidea点击:

How to do Git Log see only merges to master branch?

git

提问by WonderLand

In my work process I need to provide a list of files to my server admin. The list comes from the merge of my working branch (Branch A) into Master branch.

在我的工作过程中,我需要向我的服务器管理员提供文件列表。该列表来自我的工作分支(分支 A)合并到主分支。

So I merge branch A into branch Master and then deploy Master.

所以我将分支 A 合并到分支 Master 中,然后部署 Master。

Right now the best I could do with git logis the following but this list contains other commit as well ( not only the merge I'm looking for ):
git log -m --name-only --author=[NAME]

现在我能做的最好的git log是以下但这个列表也包含其他提交(不仅仅是我正在寻找的合并):
git log -m --name-only --author=[NAME]

So basically I need to retrieve the files list for the merge of Branch Ainto Master Branch

所以基本上我需要检索文件列表以合并Branch AMaster Branch

Is it possible with cli command ?

是否可以使用 cli 命令?

回答by Andrew C

Narrow it down using git log --merges --authorto figure out the commit you want and then try

缩小范围git log --merges --author以找出您想要的提交,然后尝试

git diff --name-only ${MERGE_SHA}^1..${MERGE_SHA}

回答by Ricardo de Cillo

I find it useful to narrow the path to first parent in order to ignore "update branch" merges.

我发现缩小到第一个父级的路径以忽略“更新分支”合并很有用。

Looks like this for me:

对我来说看起来像这样:

git log r2.8.7-2018-09-04..HEAD --merges --first-parent

git log r2.8.7-2018-09-04..HEAD --merges --first-parent