Re: [PATCH v5 0/6] {checkout,reset,stash} --patch

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Jeff King
Date: Friday, August 14, 2009 - 11:51 pm

On Thu, Aug 13, 2009 at 02:29:38PM +0200, Thomas Rast wrote:


Thanks for following up on this. This is something I've wanted for a
while, and now my procrastination is paying off. ;)


Makes sense.


Actually, it says "Unstage this hunk", but I like that even better.


This doesn't make sense to me. For example:

  $ git show HEAD^:file
  content
  $ git show :file
  content
  with some changes
  $ git reset -p HEAD^
  diff --git a/file b/file
  index d95f3ad..60a1a4e 100644
  --- a/file
  +++ b/file
  @@ -1 +1,2 @@
   content
  +with some changes
  Apply this hunk to index [y,n,q,a,d,/,e,?]?

The hunk is _already_ in the index. You are really asking to remove it
from the index. So shouldn't it say something like "Unstage this hunk"
or "Remove this hunk from the index"?

Or did you intend to reverse the diff, as with "checkout -p" below?


Good, that addresses my earlier confusion.


Good. I like how it clarifies what is being touched.


I really expected this to just be the same as the "HEAD" case. That is,
with "git checkout -p HEAD", you are saying "I'm not interested in these
bits, discard to return back to HEAD". So if I do "git checkout -p
HEAD^", that is conceptually the same thing, except going back further
in time.

But I guess you are thinking of it as "pull these changes out of
'other'", in which case showing the reverse diff makes sense.

I think this may be a situation where the user has one of two mental
models in issuing the command, and we don't necessarily know which. So I
guess what you have is fine, but I wanted to register my surprise.


Getting greedy, is there a reason not to have "stash apply -p" as well?

-Peff
--
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
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)