Subject: [PATCH v4 0/5] Re: {checkout,reset,stash} --patch

From: Nicolas Sebrecht <[email-masked]>
Date: Mon, 10 Aug 2009 00:26:58 +0200

The 09/08/09, Thomas Rast wrote:
> Nicolas Sebrecht wrote:
>
> Yes, you can, precisely as I wrote:
> 
> > > covered by 'git checkout -p HEAD'.

I did my tests including "HEAD" but only with "-- file" too...

> I figured this makes sense:
> 
>   git checkout -- file         # copy file from index to worktree
>   git checkout -p [file]       # copy hunks from index to worktree
>   git checkout HEAD -- file    # copy file from HEAD to index&worktree
>   git checkout -p HEAD -- file # copy hunks from HEAD to index&worktree

...and I don't have what's expected

  Current branch: my_branch (clean)
  nicolas@vidovic git % echo 'Hi Thomas' >> Documentation/SubmittingPatches
  Current branch: my_branch (dirty: working_tree)
  nicolas@vidovic git % git add Documentation/SubmittingPatches
  Current branch: my_branch (dirty: index)
  nicolas@vidovic git % git checkout -p HEAD -- Documentation/SubmittingPatches
  No changes.

where "checkout -p HEAD" works fine.

> Note that the patch application stage has no guarantees that what you
> picked will also apply to the index; it tries first, and if it
> doesn't, it asks if it should apply to the worktree anyway (and leave
> the index unchanged).

Ok. All of what you say above makes sense and I'm actually fine with
your whole answer. That said,

  % git checkout -p HEAD

and

  % git checkout -p HEAD -- file

behave differently here in my test above.

-- 
Nicolas Sebrecht