Can I modify git-add's hunk size?

In addition to 'y' and 'n', one of the answers you can give when it asks you about a hunk is 's', for 'split this hunk in to smaller hunks'. The full list:

y - stage this hunk
n - do not stage this hunk
q - quit, do not stage this hunk nor any of the remaining ones
a - stage this and all the remaining hunks in the file
d - do not stage this hunk nor any of the remaining hunks in the file
g - select a hunk to go to
/ - search for a hunk matching the given regex
j - leave this hunk undecided, see next undecided hunk
J - leave this hunk undecided, see next hunk
k - leave this hunk undecided, see previous undecided hunk
K - leave this hunk undecided, see previous hunk
s - split the current hunk into smaller hunks
e - manually edit the current hunk
? - print help

git gui will allow you to commit single lines, even if they are surrounded by other modified lines you do not want to commit.

Tags:

Git

Patch

Add