Retaining Git Commit History in commit message when Merging branches in Git

时间:2015-07-28 22:48:45

标签: git merge commit git-merge gerrit

Is there a command or option in Git that I can use when merging one branch into another so that the entire commit history / the commits that are getting merged show up in the commit text. So that whenever I do a git log I can also see all the commits that were merged as part of this merge commit?

2 个答案:

答案 0 :(得分:2)

作为minitech commentsgit merge --log会列出要合并的文件(并将它们附加到您可以在git merge -m "..."中指定的实际邮件中)。

但实际使用的命令是:

git merge --log=1000 <other options depending on your merge>

不要忘记为--log选项使用足够大的数字:默认情况下,仅列出20个提交:请参阅“How to get the full message from git merge --log”。

答案 1 :(得分:0)

为了便于以后合并,您还可以将选项添加到.gitconfig文件中:

...
[merge]
        log = 1000
...