Re: [PATCH v4 0/5] Re: {checkout,reset,stash} --patch
- From
Thomas Rast <trast@student.ethz.ch>
- Date
- Aug 9, 2009, 21:42 UTC
- Message-ID
- <200908092342.31733.trast@student.ethz.ch>
- In-Reply-To
- <20090809212831.GA12932@vidovic>
Nicolas Sebrecht wrote:
Show 10 quoted lines
> The 09/08/09, Thomas Rast wrote: > > > > Since you can't say 'git reset --hard -- file', you have to do 'git > > checkout HEAD -- file' to achieve this effect. So this usage is > > covered by 'git checkout -p HEAD'. > > So, we can discard a hunk from the index with 'git reset -p' without > touching the WT. And we can discard a hunk from the WT with 'git > checkout -p' without touching the index. But we can't discard a hunk > from both the index and the WT.
Yes, you can, precisely as I wrote:
> > covered by 'git checkout -p HEAD'.
^^^^
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
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).
--
Thomas Rast
trast@{inf,student}.ethz.ch