How can I split up a Git commit buried in history?

  1. Perform an interactive rebase including the target commit (e.g. git rebase -i <commit-to-split>^ branch) and mark it to be edited.

  2. When the rebase reaches that commit, use git reset HEAD^ to reset to before the commit, but keep your work tree intact.

  3. Incrementally add changes and commit them, making as many commits as desired. add -p can be useful to add only some of the changes in a given file. Use commit -c ORIG_HEAD if you want to re-use the original commit message for a certain commit.

  4. If you want to test what you're committing (good idea!) use git stash to hide away the part you haven't committed (or stash --keep-index before you even commit it), test, then git stash pop to return the rest to the work tree. Keep making commits until you get all modifications committed, i.e. have a clean work tree.

  5. Run git rebase --continue to proceed applying the commits after the now-split commit.