[PATCH v4 0/5] Re: {checkout,reset,stash} --patch
- From
- Nicolas Sebrecht <nicolas.s.dev@gmx.fr>
- Date
- Aug 9, 2009, 22:26 UTC
- Message-ID
- <20090809222658.GB12932@vidovic>
- In-Reply-To
- <200908092342.31733.trast@student.ethz.ch>
The 09/08/09, Thomas Rast wrote:
Show 5 quoted lines
> 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...
Show 6 quoted lines
> 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