public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Pete Harlan <pgit@pcharlan•com>
To: John Tapsell <johnflux@gmail•com>
Cc: Ron Garret <ron@flownet•com>, git@vger•kernel.org
Subject: Re: Stepping through a single file's history
Date: Sun, 31 Jan 2010 00:26:07 -0800	[thread overview]
Message-ID: <4B653E9F.2080109@pcharlan.com> (raw)
In-Reply-To: <43d8ce651001281758x79965b5fn8760b69d4fe82a36@mail.gmail.com>

On 01/28/2010 05:58 PM, John Tapsell wrote:
> 2010/1/29 Ron Garret <ron@flownet•com>:
>> Hello,
>> 
>> Is there an easy way to step through the history of a single file?
>> To be more specific:
> ...
>> (The use case here is remembering that back in the day there was
>> some useful code in this file that I want to retrieve, but not
>> remembering exactly when it was deleted.  So I want to step back
>> through this file's history and do diffs against HEAD.)
> 
> How about simply doing:
> 
> git log -p filename
> 
> and then you can search by pressing "/"  and then typing whatever you
> remember.
> 
> John

Have you tried "git log -Sfoo filename", which finds commits that
changed the number of occurrances of string "foo" in filename?  I've
found that quite useful in digging up deleted code.

It's not as thorough as grepping "git log -p filename", but in practice
I've found it very effective.

--Pete

      parent reply	other threads:[~2010-01-31  8:26 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-29  1:28 Stepping through a single file's history Ron Garret
2010-01-29  1:58 ` John Tapsell
2010-01-29  3:47   ` John Tapsell
2010-01-31  8:26   ` Pete Harlan [this message]

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=4B653E9F.2080109@pcharlan.com \
    --to=pgit@pcharlan$(echo .)com \
    --cc=git@vger$(echo .)kernel.org \
    --cc=johnflux@gmail$(echo .)com \
    --cc=ron@flownet$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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