Can I split an already split hunk with git?

If you’re using git add -p and even after splitting with s, you don’t have a small enough change, you can use e to edit the patch directly.

This can be a little confusing, but if you carefully follow the instructions in the editor window that will be opened up after pressing e then you’ll be fine. In the case you’ve quoted, you would want to replace the - with a space at the beginning of these lines:

-
-form.table-form #field_teacher + label,
-form.table-form #field_producer_distributor + label {

… and delete the the following line, i.e. the one that begins with +. If you then save and exit your editor, just the removal of the CSS comment will be staged.

Leave a Comment