From: Michael J Gruber <git@drmicha.warpmail.net>
To: Chunlin Zhang <zhangchunlin@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: How to git checkout a orgin(unstage) version file in another directoy?
Date: Thu, 17 Feb 2011 09:26:21 +0100 [thread overview]
Message-ID: <4D5CDBAD.4050700@drmicha.warpmail.net> (raw)
In-Reply-To: <loom.20110217T074533-358@post.gmane.org>
Chunlin Zhang venit, vidit, dixit 17.02.2011 08:00:
> 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
next prev parent reply other threads:[~2011-02-17 8:29 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-17 7:00 How to git checkout a orgin(unstage) version file in another directoy? Chunlin Zhang
2011-02-17 8:26 ` Michael J Gruber [this message]
2011-02-17 10:03 ` Chunlin Zhang
2011-02-17 10:17 ` Chunlin Zhang
2011-02-17 12:35 ` Michael J Gruber
2011-02-17 13:30 ` Chunlin Zhang
2011-02-17 18:33 ` Junio C Hamano
2011-02-18 7:41 ` Michael J Gruber
2011-02-17 10:34 ` Jonathan Nieder
2011-02-17 12:06 ` Chunlin Zhang
2011-02-17 17:17 ` Andreas Schwab
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4D5CDBAD.4050700@drmicha.warpmail.net \
--to=git@drmicha.warpmail.net \
--cc=git@vger.kernel.org \
--cc=zhangchunlin@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).