how to split a hunk
There are occasions where diff of a file is
- aaaa
+ bbbb
+ cccc
I want to add lines bbbb and cccc as separated commits, but git-add -p seem cannot further split this hunk. Do I have no choice but to edit it by hand and commit the bbbb and then edit the file to add back the cccc?
Signature · 4 lines
regards, ==================================================== GPG key 1024D/4434BAB3 2008-08-24 gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3
Quoted 10 lines · bill lam
There are occasions where diff of a file is
- aaaa
+ bbbb
+ ccccI want to add lines bbbb and cccc as separated commits, but git-add -p seem cannot further split this hunk. Do I have no choice but to edit it by hand and commit the bbbb and then edit the file to add back the cccc?
There's also the 'git add -p' [e]dit feature, which pops up the patch in an editor. There are instructions in that file, but in this case, you can simply remove one of the additions.
Signature · 2 lines
Thomas Rast
trast@{inf,student}.ethz.chQuoted 3 lines · Thomas Rast
There's also the 'git add -p' [e]dit feature, which pops up the patch in an editor. There are instructions in that file, but in this case, you can simply remove one of the additions.
Thank you for pointing out the [e], incidentally after trying it, I also noticed and tried the add -e which belongs to a similar format.
Signature · 4 lines
regards, ==================================================== GPG key 1024D/4434BAB3 2008-08-24 gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3
Quoted 11 lines · bill lam
There are occasions where diff of a file is
- aaaa
+ bbbb
+ ccccI want to add lines bbbb and cccc as separated commits, but git-add -p seem cannot further split this hunk. Do I have no choice but to edit it by hand and commit the bbbb and then edit the file to add back the cccc?
I like to use "git gui" for this. This allows you to pick individual lines to commit. I really like the "git gui" interface for staging/unstaging changes and making a series of commits.
-Geert
Quoted 3 lines · Geert Bosch
I like to use "git gui" for this. This allows you to pick individual lines to commit. I really like the "git gui" interface for staging/unstaging changes and making a series of commits.
Thank you suggestion. However I did not use git-gui/gitk or have tcl installed.
Signature · 4 lines
regards, ==================================================== GPG key 1024D/4434BAB3 2008-08-24 gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3