How to query the version of a file?

5 messages, 5 authors, 2016-06-15 · open the first message on its own page

How to query the version of a file?

From: Edmond Halley <hidden>
Date: 2016-06-15 22:49:23

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

Re: How to query the version of a file?

From: Todd A. Jacobs <hidden>
Date: 2016-06-15 22:49:23

On Wed, Aug 25, 2010 at 2:33 AM, Edmond Halley [off-list ref] wrote:
I have a standalone repository.
File a.cpp has 3 versions.
For example, I checked out version2(HEAD^).
quoted
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.

Re: How to query the version of a file?

From: sandy2010 <hidden>
Date: 2016-06-15 22:49:38

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.

Re: How to query the version of a file?

From: Michael J Gruber <hidden>
Date: 2016-06-15 22:49:38

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

Re: How to query the version of a file?

From: Pascal Obry <hidden>
Date: 2016-06-15 22:49:38

On Tue, Sep 28, 2010 at 12:49 PM, sandy2010 [off-list ref] 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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help