Re: [PATCH] git-add -p: be able to undo a given hunk

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Pierre Habouzit <madcoder@xxxxxxxxxx> writes:

> One of my most frequent use case for git-add -p is when I had an intense
> debug session with quite a lot of debug() traces added. I then want only
> to select the hunks corresponding to the bugfixes and throw away the debug
> ones.

I do not particularly like this change.  "add -i", "add -p" and "add" in
general are about manipulating the index.  They are never meant to touch
the work tree contents.  Which means that even if you make a mistake in
saying y/n, you won't damange the state you have in your work tree, and
also means that you can recover safely by simply restarting "add -p"
session if you really botched splitting of the patch.

I fear tempting a new user who sees "undo" to say "yeah, I added the
change in this hunk to the index by mistake, please undo", which would
lose the work.  The confusion is easier to avoid if "add" only manipulates
the index without harming the work tree, and the user used a different
command, namely "checkout from the index", to get rid of the remaining
debug cruft, once s/he added all the necessary bits to the index perhaps
after a multi-stage commit session.

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]