在 git merge commit 中列出所有修改过的文件 - 即使是快进的 [英] List all modified files in git merge commit - even the fast forwarded
问题描述
我在想是否有一种方法可以在我将一个分支合并到另一个分支时,所有更改的文件都列在我的提交消息中,而不仅仅是在两个分支中修改的文件.通过查看合并提交,这将使我更好地了解分支中的更改内容.有没有办法做到这一点?
I'm thinking if there is a way that when I merge a branch into another branch that ALL changed files are listed in my commit message and not just the ones which were modified in both branches. This would give me a better overview of what was changed in the branch just by seeing the merge commit. Is there a way to do this?
推荐答案
我不知道如何在提交消息中执行此操作.但是在合并之后,这将给出受合并提交影响的所有文件的名称:
I don't know how to do that in the commit message. But after the merge, this will give the names of all the files affected by the merge commit:
git log -m --name-only
仅针对提交的文件名列表:
For only a list of filenames of the commit:
git log -m -1 --name-only --pretty="format:" <Merge SHA>
由于合并有两个父级,因此存在一些空白,但可以轻松删除.
There is some white space due to the merge having two parents but that can be easily removed.
这篇关于在 git merge commit 中列出所有修改过的文件 - 即使是快进的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!