On Thursday, March 14, 2013 11:54:36 AM UTC-7, Konstantin Khomoutov wrote:
>
> On Thu, Mar 14, 2013 at 11:24:27AM -0700, joeri...@gmail.com 
> <javascript:>wrote: 
>
> > How do I reset one working file, but leave the index alone?  git 
> checkout 
> > file does not do that 
> > (it appears to do nothing), nor does git checkout -- file. 
> > 
> > To clarify, I've edited a file, then added it to the index. I now want 
> to 
> > leave the change in the index, 
> > but reset the working file to the checked-in version.   
>
> git checkout HEAD -- file 
>

That does not work.  It resets the index and the working space. 

>
> or 
>
> git show HEAD:file >file 
>

This does work.  Seems slightly crude, but better than nothing. 

>
> `git checkout -- file` did not work for you because if you don't specify 
> where to get the contents from, it assumes the index -- to cite the 
> manual: 
>
>   When <paths> or --patch are given, git checkout does not switch 
>   branches. It updates the named paths in the working tree from the index 
>   file or from a named <tree-ish> (most often a commit). 
>
>

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to