git rebase不显示合并提交

时间:2015-03-29 13:27:50

标签: git git-rebase

当我git rebase -i HEAD~4时,我会得到类似的结果:

pick 7e2dd90 refactor some function
pick dad8a9e fix another bug
pick 4ba8c24 add another feature
pick aca4ba3 do other stuff
pick dd0b3e6 add feature
pick 8dad92f fix bug
pick 8571d0c stuff
pick 25b328c whatever
pick 1803bca demo commit
pick 9723acc hello, world
pick 3ff4212 blahblah
pick c5c3bcf missed a file in merge

当我git log时,我得到了这个:

commit c5c3bcf0ac65d1423ddc2785b2f9ac3ecbd930d9
Author: neubert
Date:   Sat Mar 28 22:11:08 2015 -0500

    missed a file in merge

commit 198bb3c61f62de47706fdfa3171bb79b4a0496a1
Merge: cae37ae bb01002
Author: neubert
Date:   Sat Mar 28 21:54:51 2015 -0500

    Merge branch 'branchname' into anotherbranch

    Conflicts:
        path/to/filename.ext

commit bb01002233f1eff5d42b6964e33830633f710ee1
Merge: c8fe3c3 3ff4212
Author: neubert
Date:   Sat Mar 28 21:03:17 2015 -0500

    Merge remote-tracking branch 'athirdbranchname'

commit 3ff4212b9291f2c863a742f5692ca7312b81decb
Author: neubert
Date:   Tue Mar 24 13:40:42 2015 +0800

    blahblah

commit 9723acc8853c5fe7ea9bda4a9a711a3e07575c84
Author: neubert
Date:   Tue Mar 24 13:38:56 2015 +0800

    hello, world

我的问题是......为什么不git rebase显示合并提交?这不是它的功能吗?我想将“合并中遗漏的文件”提交到合并提交,但如果我不能用rebase看到它,我就不能这样做..

另外,git rebase -i HEAD~4不应该给我四次提交 - 而不是12次?

1 个答案:

答案 0 :(得分:3)

尝试运行git rebase -i HEAD~4 --preserve-merges。这将让你看到合并提交,并且还应该将提交数限制为四个。

相关问题