Last Updated: February 25, 2016
·
1.185K
· ninjabiscuit

Git rebase around a merge

If, for example you wanted to achieve the following with your git commits

commit <- want to reword this one
merge
commit <- want to squash this one and the next one into one commit
commit

You can rebase as normal but use the --preserve-merges flag to allow you to move around the merge.

git rebase -i HEAD~4 --preserve-merges

2 Responses
Add your response

very cool

over 1 year ago ·

@mrmarktyy Thanks!

over 1 year ago ·