When I do git rebase -i HEAD~4 I get something like this:
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 When I do git log I get this:
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 My question is... why isn't git rebase showing merge commits? Is that just not something it does? I'd like to squash the "missed file in merge" commit to the merge commit but if I can't see it with rebase I can't do that..
Also, shouldn't git rebase -i HEAD~4 give me four commits - not 12?
git-rebase. See the--preserve-mergesflag in thegit-rebaseman page. Regarding your second question, it all depends on the shape of your commit graph; remember that~follows the first parent of a commit. If you edit your question and add the output ofgit log --graph --oneline --decorate, people here would be able to explain the situation better.