{"thread":{"id":"21394","subject":"how to split a hunk","startedAt":"2009-10-28T02:21:05Z","lastAt":"2009-10-28T15:26:51Z","messageCount":5,"participants":["bill lam","Geert Bosch","Thomas Rast"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"126079","messageId":"20091028022105.GE3938@debian.b2j","threadId":"21394","inReplyTo":null,"subject":"how to split a hunk","fromName":"bill lam","fromEmail":"cbill.lam@gmail.com","sentAt":"2009-10-28T02:21:05Z","receivedAt":"2009-10-28T02:21:05Z","isPatch":false,"sender":{"key":"cbill.lam@gmail.com","avatar":null},"body":"There are occasions where diff of a file is\n\n- aaaa\n+ bbbb\n+ cccc\n\nI want to add lines bbbb and cccc as separated commits, but git-add -p\nseem cannot further split this hunk.  Do I have no choice but to edit\nit by hand and commit the bbbb and then edit the file to add back the\ncccc?\n\n-- \nregards,\n====================================================\nGPG key 1024D/4434BAB3 2008-08-24\ngpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3\n"},{"id":"126081","messageId":"21963906-785A-4D98-8AD8-A89ED914920C@adacore.com","threadId":"21394","inReplyTo":"20091028022105.GE3938@debian.b2j","subject":"Re: how to split a hunk","fromName":"Geert Bosch","fromEmail":"bosch@adacore.com","sentAt":"2009-10-28T03:11:07Z","receivedAt":"2009-10-28T03:11:07Z","isPatch":false,"sender":{"key":"bosch@adacore.com","avatar":null},"body":"\nOn Oct 27, 2009, at 22:21, bill lam wrote:\n\n> There are occasions where diff of a file is\n>\n> - aaaa\n> + bbbb\n> + cccc\n>\n> I want to add lines bbbb and cccc as separated commits, but git-add -p\n> seem cannot further split this hunk.  Do I have no choice but to edit\n> it by hand and commit the bbbb and then edit the file to add back the\n> cccc?\n>\nI like to use \"git gui\" for this. This allows you to pick individual\nlines to commit. I really like the \"git gui\" interface for staging/ \nunstaging\nchanges and making a series of commits.\n\n   -Geert\n"},{"id":"126141","messageId":"200910281406.12923.trast@student.ethz.ch","threadId":"21394","inReplyTo":"20091028022105.GE3938@debian.b2j","subject":"Re: how to split a hunk","fromName":"Thomas Rast","fromEmail":"trast@student.ethz.ch","sentAt":"2009-10-28T13:06:10Z","receivedAt":"2009-10-28T13:06:10Z","isPatch":false,"sender":{"key":"tr@thomasrast.ch","avatar":"https://avatars.githubusercontent.com/u/153510?v=4"},"body":"bill lam wrote:\n> There are occasions where diff of a file is\n> \n> - aaaa\n> + bbbb\n> + cccc\n> \n> I want to add lines bbbb and cccc as separated commits, but git-add -p\n> seem cannot further split this hunk.  Do I have no choice but to edit\n> it by hand and commit the bbbb and then edit the file to add back the\n> cccc?\n\nThere's also the 'git add -p' [e]dit feature, which pops up the patch\nin an editor.  There are instructions in that file, but in this case,\nyou can simply remove one of the additions.\n\n-- \nThomas Rast\ntrast@{inf,student}.ethz.ch\n"},{"id":"126149","messageId":"20091028151631.GB3956@debian.b2j","threadId":"21394","inReplyTo":"200910281406.12923.trast@student.ethz.ch","subject":"Re: how to split a hunk","fromName":"bill lam","fromEmail":"cbill.lam@gmail.com","sentAt":"2009-10-28T15:16:31Z","receivedAt":"2009-10-28T15:16:31Z","isPatch":false,"sender":{"key":"cbill.lam@gmail.com","avatar":null},"body":"On Wed, 28 Oct 2009, Thomas Rast wrote:\n> There's also the 'git add -p' [e]dit feature, which pops up the patch\n> in an editor.  There are instructions in that file, but in this case,\n> you can simply remove one of the additions.\n\nThank you for pointing out the [e], incidentally after trying it, I\nalso noticed and tried the add -e which belongs to a similar format.\n\n-- \nregards,\n====================================================\nGPG key 1024D/4434BAB3 2008-08-24\ngpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3\n"},{"id":"126151","messageId":"20091028152651.GC3956@debian.b2j","threadId":"21394","inReplyTo":"21963906-785A-4D98-8AD8-A89ED914920C@adacore.com","subject":"Re: how to split a hunk","fromName":"bill lam","fromEmail":"cbill.lam@gmail.com","sentAt":"2009-10-28T15:26:51Z","receivedAt":"2009-10-28T15:26:51Z","isPatch":false,"sender":{"key":"cbill.lam@gmail.com","avatar":null},"body":"On Tue, 27 Oct 2009, Geert Bosch wrote:\n> I like to use \"git gui\" for this. This allows you to pick individual\n> lines to commit. I really like the \"git gui\" interface for staging/unstaging\n> changes and making a series of commits.\n\nThank you suggestion. However I did not use git-gui/gitk or have tcl\ninstalled.\n\n-- \nregards,\n====================================================\nGPG key 1024D/4434BAB3 2008-08-24\ngpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3\n"}]}