Consider the following series of commits on the local branch:
5 Correction of something meaningless, again !
4 Business correction n°3
3 Correction of something meaningless
2 Business correction n°2
1 Business correction n°1
I want to squash 5 with 3 in order to have:
4 Correction of something meaningless, squashed !
3 Business correction n°3
2 Business correction n°2
1 Business correction n°1
Can I do that with the interactive rebase ? From what I have seen (ex: https://www.internalpointers.com/post/squash-commits-into-one-git) and tested so far, I can only squash 5 with a series of direct commits, like:
You can do it with interactive rebase.
Just reorder the lines like that when prompted by git:
squash 5 Correction of something meaningless, again !
pick 3 Correction of something meaningless
pick 4 Business correction n°3
pick 2 Business correction n°2
pick 1 Business correction n°1
But, because you change the order, conflicts could happens and sometimes that don't worth rewriting the history...