Thread (5 messages) 5 messages, 5 authors, 2016-06-15

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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help