git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Todd A. Jacobs" <tjacobs@si2services.com>
To: Edmond Halley <halleyinvent@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: How to query the version of a file?
Date: Wed, 25 Aug 2010 09:27:44 -0400	[thread overview]
Message-ID: <AANLkTi=_LaHnuZ7AYDW_TCD7fhSFFdcm_hX3GHRyvwEi@mail.gmail.com> (raw)
In-Reply-To: <AANLkTi=upbiD5EBumxNxG0YvSRZN0mDfvu7LeU0y0Zpw@mail.gmail.com>

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.

  reply	other threads:[~2010-08-25 13:27 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-25  6:33 How to query the version of a file? Edmond Halley
2010-08-25 13:27 ` Todd A. Jacobs [this message]
2010-09-28 10:49 ` sandy2010
2010-09-28 11:19   ` Michael J Gruber
2010-09-28 11:26   ` Pascal Obry

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='AANLkTi=_LaHnuZ7AYDW_TCD7fhSFFdcm_hX3GHRyvwEi@mail.gmail.com' \
    --to=tjacobs@si2services.com \
    --cc=git@vger.kernel.org \
    --cc=halleyinvent@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).