简体   繁体   English

当我使用git log时如何显示git merges?

[英]How to show git merges when I use git log?

I don't know why git works like this but when I merge branch A into branch B and then use git log on branch B , all I see are the logs of all my commits from branch A . 我不知道git为什么会这样工作,但是当我将分支A合并到分支B中 ,然后在分支B上使用git log时,我所看到的只是我从分支A提交的所有日志。 I thought I would see the list of commits and on top of those commits it would say "Merged a into B" . 我以为我会看到提交列表,在这些提交的最上面会说a合并到B中”

I know I have seen in my log files "Merge branch 'a' into branch 'b'" when I worked on other projects so I don't know what I am doing wrong. 我知道我在其他项目上工作时在日志文件“将分支'a'合并到分支'b'”中看到过,所以我不知道自己在做什么错。 What I am doing is completing a branch so I know it works. 我正在做的是完成一个分支,所以我知道它可以工作。 Checking out development and then merging the last branch I worked on into development. 检查开发,然后将我从事的最后一个分支合并到开发中。 Any idea what I'm doing wrong? 知道我在做什么错吗?

Git defaults to fast-forward merge option when there are no commits in branch B . 当分支B中没有提交时,Git默认使用快速转发合并选项。
You have to use --no-ff switch to always create merge commit. 您必须使用--no-ff开关始终创建合并提交。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM