Last Updated: February 25, 2016
· destructuring

Rebase feature branches into multiple commits

My feature branches have lots of typo, revert, and work-in-progress commits. They can get pretty large, too. Instead of merging the entire history or collapsing into one huge commit, I take the changes and organize my commits across groups of files. You have to organize your repo so that these groupings make sense.

Say I'm merging from feature/tom/ubuntu_precise onto develop branch. I'll merge with --squash --no-commit to flatten all the changes but not make a commit. Everything will be put into the index.

I'll reset the index with "git --reset" so I can git add and git rm into the change-sets I want. One commit for bin scripts to support some new directory structure in Ubuntu Precise (backwards compatible); one commit for the veewee and vagrant definitions for Precise. Another commit for documentation.

This also lets me write longer, coherent commit messages.