Squash and split with git

I have been doing a lot of piecing out commits to break them into related feature-coherent sets lately, so I thought I’d share the webpage I used as a reference.

Basically the mechanism uses the same git rebase –interactive that you can use to squash commits, but instead opens one for editing mid-rebase.  Then you can revert it, and use git add -p filename for an interactive selection of chunks to leave in or out.  Add some git commit for your new pieces, and then git rebase –continue to finish.

Complete steps here.  The payoff is that git add -p is a great complement to interactive rebase.

Tags:

Leave a Reply