views:

74

answers:

1

Is this possible? It would be nice if I didn't have to switch back and forth between git-add -i and git commit when breaking apart hunks into different commits. Is there a better way to do this? Or am I doing something wrong?

+2  A: 

As described in the git book, a simple git commit is still required after a git add --interactive session.
(With the following caveat:

Remember not to run 'git commit -a', which will blow away all the careful changes you've just made and simply commit everything )

Note: maybe git add -p (--patch) will be a little more convenient:

Interactively choose hunks of patch between the index and the work tree and add them to the index. This gives the user a chance to review the difference before adding modified contents to the index.

This effectively runs add --interactive, but bypasses the initial command menu and directly jumps to the patch subcommand.

VonC