* How to query the version of a file?
@ 2010-08-25 6:33 Edmond Halley
2010-08-25 13:27 ` Todd A. Jacobs
2010-09-28 10:49 ` sandy2010
0 siblings, 2 replies; 5+ messages in thread
From: Edmond Halley @ 2010-08-25 6:33 UTC (permalink / raw)
To: git
Hi,
I have a standalone repository.
File a.cpp has 3 versions.
For example, I checked out version2(HEAD^).
> git checkout HEAD^ a.cpp
After a few days, I forget which version I have checked out.
Is there a git command that can query which version is checked out?
"git status" will show there is "changes to be committed", but with no
the version information.
Thank you!
Best regards,
Halley
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: How to query the version of a file?
2010-08-25 6:33 How to query the version of a file? Edmond Halley
@ 2010-08-25 13:27 ` Todd A. Jacobs
2010-09-28 10:49 ` sandy2010
1 sibling, 0 replies; 5+ messages in thread
From: Todd A. Jacobs @ 2010-08-25 13:27 UTC (permalink / raw)
To: Edmond Halley; +Cc: git
On Wed, Aug 25, 2010 at 2:33 AM, Edmond Halley <halleyinvent@gmail.com> wrote:
> I have a standalone repository.
> File a.cpp has 3 versions.
> For example, I checked out version2(HEAD^).
>> git checkout HEAD^ a.cpp
> After a few days, I forget which version I have checked out.
> Is there a git command that can query which version is checked out?
There may be an easier way to do this, but the way I do it is (sort
of) documented in
http://www.kernel.org/pub/software/scm/git/docs/user-manual.html#Finding-comments-With-given-Content
(should be "commits" instead of "comments", but oh well!) and can be
tweaked to suit yourself:
git log --raw --abbrev=40 --pretty=oneline |
grep -B 24 `git hash-object a.cpp`
There may be other, and possibly more efficient, ways to do this, but
it generally works for me.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: How to query the version of a file?
2010-08-25 6:33 How to query the version of a file? Edmond Halley
2010-08-25 13:27 ` Todd A. Jacobs
@ 2010-09-28 10:49 ` sandy2010
2010-09-28 11:19 ` Michael J Gruber
2010-09-28 11:26 ` Pascal Obry
1 sibling, 2 replies; 5+ messages in thread
From: sandy2010 @ 2010-09-28 10:49 UTC (permalink / raw)
To: git
I do not see the reply to this thread. I'm unable to find how to find the
version of a checked out file? Also, how do I view an older version?
--
View this message in context: http://git.661346.n2.nabble.com/How-to-query-the-version-of-a-file-tp5459953p5578850.html
Sent from the git mailing list archive at Nabble.com.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: How to query the version of a file?
2010-09-28 10:49 ` sandy2010
@ 2010-09-28 11:19 ` Michael J Gruber
2010-09-28 11:26 ` Pascal Obry
1 sibling, 0 replies; 5+ messages in thread
From: Michael J Gruber @ 2010-09-28 11:19 UTC (permalink / raw)
To: sandy2010; +Cc: git
sandy2010 venit, vidit, dixit 28.09.2010 12:49:
>
> I do not see the reply to this thread. I'm unable to find how to find the
> version of a checked out file? Also, how do I view an older version?
Todd already answered to your address as well as to the list (3 days
ago). Your 2nd question is answered in the same place he pointed you to:
http://www.kernel.org/pub/software/scm/git/docs/user-manual.html#viewing-old-file-versions
Now, what do you think is the top hit when googling "git view older
version" ;)
Michael
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: How to query the version of a file?
2010-09-28 10:49 ` sandy2010
2010-09-28 11:19 ` Michael J Gruber
@ 2010-09-28 11:26 ` Pascal Obry
1 sibling, 0 replies; 5+ messages in thread
From: Pascal Obry @ 2010-09-28 11:26 UTC (permalink / raw)
To: sandy2010; +Cc: git
On Tue, Sep 28, 2010 at 12:49 PM, sandy2010 <sandeeptt@yahoo.com> wrote:
> I do not see the reply to this thread. I'm unable to find how to find the
> version of a checked out file? Also, how do I view an older version?
No response probably because there is no notion of version of a file in Git.
Each commit is uniquely identified (SHA-1). A file is part of a commit.
I would recommend to read some Git tutorials, books that can be found
on the Web. See Git wiki, or the online Pro Git book:
http://progit.org/book/
Pascal.
--
--|------------------------------------------------------
--| Pascal Obry Team-Ada Member
--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE
--|------------------------------------------------------
--| http://www.obry.net
--| "The best way to travel is by means of imagination"
--|
--| gpg --keyserver wwwkeys.pgp.net --recv-key C1082595
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2010-09-28 11:27 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-25 6:33 How to query the version of a file? Edmond Halley
2010-08-25 13:27 ` Todd A. Jacobs
2010-09-28 10:49 ` sandy2010
2010-09-28 11:19 ` Michael J Gruber
2010-09-28 11:26 ` Pascal Obry
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).