[prev in list] [next in list] [prev in thread] [next in thread] 

List:       git
Subject:    Re: [PATCH] git-add -p: be able to undo a given hunk
From:       Pierre Habouzit <madcoder () madism ! org>
Date:       2009-07-25 14:52:37
Message-ID: 20090725145237.GB18545 () artemis ! corp
[Download RAW message or body]

On Fri, Jul 24, 2009 at 09:06:16AM -0700, Junio C Hamano wrote:
> Even though you could add good bits interactively, making multiple
> commits, and remove the remaining debugging cruft at the very end with
> "git checkout $files" or "git reset --hard", if there are debugging crufts
> for two or more phases of development,

FWIW it's what I was doing so far, and it's not very efficient for many
patterns, you talked about the bit where you want to keep some of the
debug, for this one I used to do that:

while I have meaning full commits to do:
    git add -p; commit;
git add -p the things I want to trash and commit
git stash
git reset --hard HEAD~1
git stash apply

That sucks.

Another thing is that: if you have _many_ commits to do, you have to
refuse the same hunks (or worse edit) all over the place. That's awful.
With an "undo", you look at them once only. That's a lot of thinking
saved, and when you have a lot of hunks, less chances to mess an answer
(who here hasn't typed 'y' where he meant 'n' at least once ...)


For all those reasons I believe it's a good thing to be able to have
something to remove hunks from the working-directory. Jeff's suggestions
to move them to some stash is the best suggestion so far, and is safe.

-- 
Intersec <http://www.intersec.com>
Pierre Habouzit <pierre.habouzit@intersec.com>
Tél : +33 (0)1 5570 3346
Mob : +33 (0)6 1636 8131
Fax : +33 (0)1 5570 3332
37 Rue Pierre Lhomme
92400 Courbevoie

["signature.asc" (application/pgp-signature)]
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic