git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Is there any efficient way to track history of a piece of code?

From
Junio C Hamano <gitster@pobox.com>
Date
May 8, 2014, 18:34 UTC
Message-ID
<xmqq1tw43yrx.fsf@gitster.dls.corp.google.com>
In-Reply-To
<CAHz2CGV6==abb0SrXOyqwumxEVLFnTtqe1Z4j2A7XcvJNuoAHw@mail.gmail.com>
Jianyu Zhan <nasa4836@gmail.com> writes:
Show 14 quoted lines
> On Thu, May 8, 2014 at 3:00 PM, Jeff King <peff@peff.net> wrote:
>> Try "tig blame"[1]; from the blame view, the "," command will restart
>> the blame at REF^ automatically.  If you don't mind a more graphical
>> interface, I think "git gui blame" can also reblame from the parent from
>> the right-click context menu.
>
> Thanks! It helps!
>
> Hmm, but you know, we are cli people so we met git ;-)
>
> My by-hand recursive digging history works for me and I've consider automate
> this but failed since the pattern match to find the correct line of
> code in each recursion
> is a big problem.

Yes, by definition, there is no corresponding line in a version behind the version shown in the blame output, so there needs some heuristics, such as "assume the same line range", "find the beginning and the end of the function definition that contains that line", etc.

Previous: Jianyu ZhanNext: David Lang
Message 4 of 7 in “Is there any efficient way to track history of a piece of code?”
  1. Jianyu ZhanMay 8, 2014
  2. Jeff KingMay 8, 2014
  3. Jianyu ZhanMay 8, 2014
  4. Junio C HamanoMay 8, 2014
  5. David LangMay 9, 2014
  6. David KastrupMay 8, 2014
  7. Chris PackhamMay 8, 2014

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.