Here is my structure:
* - commit 2
|
* - commit 1
|
* - Merge commit (feature #1)
|\
| * - Feature #1 commit
|/
*
I messed up previously and now my history doesn't look as clean as I'd like.
I'd like to know if there is a simple way to squash 'commit 1' and 'commit 2' into 'Merge commit (feature #1)', so that I end up with something like this:
* - Merge commit (feature #1)
|\
| * - Feature #1 commit
|/
*
rebase -i doesn't seem to recognise the merge commit, and seems like it will squash everything into 'Feature #1 commit', which is not desirable.
Thanks
Make sure that you do not have anything staged (
git added). Then just dogit reset --softdoes not change what you have in the working directory nor what you have staged. Therefore, if you havegit added content after you made "commit 2", then thegit commit --amendwould commit those staged content as well. For this reason, you have to make sure that you have nothing staged when you begin.git statusshould tell you whether that is the case.