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
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.
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