Re: How to git checkout a orgin(unstage) version file in another directoy?
- From
Michael J Gruber <git@drmicha.warpmail.net>
- Date
- Feb 17, 2011, 08:26 UTC
- Message-ID
- <4D5CDBAD.4050700@drmicha.warpmail.net>
- In-Reply-To
- <loom.20110217T074533-358@post.gmane.org>
Chunlin Zhang venit, vidit, dixit 17.02.2011 08:00:
Show 15 quoted lines
> I am writing a script for git-gui's "Tools" menu to diff a file. > I want to checkout an origin file in a tmp directory and use the diff tool. > Now it is ok to those unstage file,but to those staged file, > I found that I do not know how to checkout the orgin(unstage) version. > > In detail,I change current directory to a tmp directory, > and use for example > 'git --work-tree=. --git-dir="/media/linux/t/kernel/.git" checkout README' > to checkout origin version. > > Does anyone can help with this? > I look the git help and can not find way till now. > > Thanks! >
I'm not sure what you mean by "origin" version, but if you mean the version from the current revision (before making and staging changes), you would check out from HEAD instead of from the index:
git --work-tree=. --git-dir="/media/linux/t/kernel/.git" checkout HEAD -- README
Michael