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

Has anyone tried to implement git grep --blame?

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
May 29, 2013, 05:41 UTC
Message-ID
<CACBZZX5R=zaNBv4OGh30dxj+BAi26jDxDBO5pZTQ2QxGUB6WXw@mail.gmail.com>
This would be so much more convenient if git-grep supported it natively:

$ git grep -n 'if \(0\)' | perl -pe's/([^:]+):([^:]+).*/`git blame -L $2,$2 $1`/se' d18f76dc (Ævar Arnfjörð Bjarmason 2010-08-17 09:24:38 +0000 2278) if (0) 65648283 (David Brown 2007-12-25 19:56:29 -0800 433) if (0) {

I.e. with all the coloring/pager interaction. Some Googling around reveals people piping things to git-blame like that, but has anyone made a stab at a smarter implementation (that would know to blame the whole file if it had lots of hits etc..).

Don't know if I have time myself, but I'd be very pleased if someone hacked that up.

Next: Jakub Narebski
Message 1 of 2 in “Has anyone tried to implement git grep --blame?”
  1. Ævar Arnfjörð BjarmasonMay 29, 2013
  2. Jakub NarebskiMay 30, 2013

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.