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

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Pierre Habouzit
Date: Saturday, July 25, 2009 - 7:52 am

On Fri, Jul 24, 2009 at 09:06:16AM -0700, Junio C Hamano wrote:

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
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] git-add -p: be able to undo a given hunk, Pierre Habouzit, (Thu Jul 23, 12:41 am)
Re: [PATCH] git-add -p: be able to undo a given hunk, Thomas Rast, (Thu Jul 23, 1:41 am)
Re: [PATCH] git-add -p: be able to undo a given hunk, Pierre Habouzit, (Thu Jul 23, 1:50 am)
Re: [PATCH] git-add -p: be able to undo a given hunk, Junio C Hamano, (Thu Jul 23, 12:58 pm)
Re: [PATCH] git-add -p: be able to undo a given hunk, Nanako Shiraishi, (Fri Jul 24, 3:32 am)
Re: [PATCH] git-add -p: be able to undo a given hunk, Pierre Habouzit, (Fri Jul 24, 7:58 am)
Re: [PATCH] git-add -p: be able to undo a given hunk, Junio C Hamano, (Fri Jul 24, 9:06 am)
[RFC PATCH v2 1/3] Introduce git-unstage, Thomas Rast, (Fri Jul 24, 9:24 am)
[RFC PATCH v2 2/3] Introduce git-discard, Thomas Rast, (Fri Jul 24, 9:24 am)
Re: [RFC PATCH v2 3/3] Implement unstage --patch and disca ..., Matthias Kestenholz, (Fri Jul 24, 9:40 am)
Re: [PATCH] git-add -p: be able to undo a given hunk, Jeff King, (Fri Jul 24, 10:06 am)
Re: [RFC PATCH v2 1/3] Introduce git-unstage, Bert Wesarg, (Fri Jul 24, 10:59 am)
Re: [RFC PATCH v2 1/3] Introduce git-unstage, Bert Wesarg, (Fri Jul 24, 11:02 am)
Re: [RFC PATCH v2 2/3] Introduce git-discard, Elijah Newren, (Fri Jul 24, 11:02 am)
Re: [RFC PATCH v2 2/3] Introduce git-discard, Bert Wesarg, (Fri Jul 24, 11:12 am)
Re: [RFC PATCH v2 1/3] Introduce git-unstage, Elijah Newren, (Fri Jul 24, 11:23 am)
Re: [RFC PATCH v2 2/3] Introduce git-discard, Elijah Newren, (Fri Jul 24, 11:24 am)
Re: [PATCH] git-add -p: be able to undo a given hunk, Junio C Hamano, (Fri Jul 24, 5:54 pm)
Re: [PATCH] git-add -p: be able to undo a given hunk, Thomas Rast, (Sat Jul 25, 2:35 am)
Re: [PATCH] git-add -p: be able to undo a given hunk, Pierre Habouzit, (Sat Jul 25, 7:48 am)
Re: [PATCH] git-add -p: be able to undo a given hunk, Pierre Habouzit, (Sat Jul 25, 7:52 am)
Re: [RFC PATCH v2 2/3] Introduce git-discard, Pierre Habouzit, (Sat Jul 25, 7:58 am)
[RFC PATCH v3 0/5] {checkout,reset,stash} --patch, Thomas Rast, (Sat Jul 25, 2:29 pm)
[RFC PATCH v3 3/5] Implement 'git reset --patch', Thomas Rast, (Sat Jul 25, 2:29 pm)
[RFC PATCH v3 4/5] Implement 'git checkout --patch', Thomas Rast, (Sat Jul 25, 2:29 pm)
[RFC PATCH v3 5/5] Implement 'git stash save --patch', Thomas Rast, (Sat Jul 25, 2:29 pm)
Re: [RFC PATCH v3 5/5] Implement 'git stash save --patch', Sverre Rabbelier, (Sat Jul 25, 11:03 pm)
Re: [PATCH] git-add -p: be able to undo a given hunk, Pierre Habouzit, (Mon Jul 27, 1:26 am)
Re: [PATCH] git-add -p: be able to undo a given hunk, Thomas Rast, (Mon Jul 27, 3:06 am)
Re: [RFC PATCH v3 0/5] {checkout,reset,stash} --patch, Thomas Rast, (Mon Jul 27, 3:10 am)
[PATCH v4 0/5] {checkout,reset,stash} --patch, Thomas Rast, (Tue Jul 28, 2:20 pm)
[PATCH v4 3/5] Implement 'git reset --patch', Thomas Rast, (Tue Jul 28, 2:20 pm)
[PATCH v4 4/5] Implement 'git checkout --patch', Thomas Rast, (Tue Jul 28, 2:20 pm)
[PATCH v4 5/5] Implement 'git stash save --patch', Thomas Rast, (Tue Jul 28, 2:20 pm)
Re: [PATCH v4 0/5] {checkout,reset,stash} --patch, Jeff King, (Sat Aug 8, 11:52 pm)
Re: [PATCH v4 0/5] {checkout,reset,stash} --patch, Thomas Rast, (Sun Aug 9, 2:17 am)
[PATCH v4 0/5] Re: {checkout,reset,stash} --patch, Nicolas Sebrecht, (Sun Aug 9, 9:32 am)
[PATCH v4 0/5] Re: {checkout,reset,stash} --patch, Nicolas Sebrecht, (Sun Aug 9, 2:28 pm)
[PATCH v4 0/5] Re: {checkout,reset,stash} --patch, Nicolas Sebrecht, (Sun Aug 9, 3:26 pm)
Re: [PATCH v4 0/5] Re: {checkout,reset,stash} --patch, Thomas Rast, (Mon Aug 10, 2:36 am)
[PATCH v5 0/6] {checkout,reset,stash} --patch, Thomas Rast, (Thu Aug 13, 5:29 am)
[PATCH v5 2/6] Add a small patch-mode testing library, Thomas Rast, (Thu Aug 13, 5:29 am)
[PATCH v5 4/6] Implement 'git reset --patch', Thomas Rast, (Thu Aug 13, 5:29 am)
[PATCH v5 5/6] Implement 'git checkout --patch', Thomas Rast, (Thu Aug 13, 5:29 am)
[PATCH v5 6/6] Implement 'git stash save --patch', Thomas Rast, (Thu Aug 13, 5:29 am)
[PATCH v5 0/6] Re: {checkout,reset,stash} --patch, Nicolas Sebrecht, (Fri Aug 14, 1:57 pm)
Re: [PATCH v5 0/6] {checkout,reset,stash} --patch, Jeff King, (Fri Aug 14, 11:51 pm)
Re: [PATCH v5 0/6] {checkout,reset,stash} --patch, Junio C Hamano, (Sat Aug 15, 12:57 am)
Re: [PATCH v5 0/6] {checkout,reset,stash} --patch, Thomas Rast, (Sat Aug 15, 3:04 am)
Re: [PATCH v5 0/6] {checkout,reset,stash} --patch, Thomas Rast, (Sat Aug 15, 3:14 am)
[PATCH v5.1 5/6] Implement 'git checkout --patch', Thomas Rast, (Sat Aug 15, 4:48 am)
[PATCH v5.1 4/6] Implement 'git reset --patch', Thomas Rast, (Sat Aug 15, 4:48 am)
Re: [PATCH v5 0/6] {checkout,reset,stash} --patch, Jeff King, (Tue Aug 18, 9:48 am)
Re: [PATCH v5 0/6] {checkout,reset,stash} --patch, Thomas Rast, (Wed Aug 19, 2:40 am)
Re: [PATCH v5 0/6] {checkout,reset,stash} --patch, Jeff King, (Wed Aug 19, 3:11 am)