Git: Picking which diffs to stage

git add typically stages files on a file-by-file basis, but you can stage single diff pieces (hunks) of a file with the --patch (or -p) option to git add.

It will open an interactive console application to let you pick which hunks to stage.

Explained in more detail here: