git: Splitting commits

git wonders never cease. This page describes how to use git rebase -i to split commits. (Thanks Chris Lalancette and Stephen Tweedie).

Stephen notes also: “git diff --cached isn’t mentioned in that git-rebase page, but it’s an invaulable part of the process”. Use git diff --cached during the splitting process to see which commits you’ve added to the index but not committed yet. This lets you see what your split commit will look like.

1 Comment

Filed under Uncategorized

One response to “git: Splitting commits

  1. Clint ‘herlo’ Savage showed me this at one point and I was thoroughly amazed.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.