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

Re: git blame for a commit

From
Jakub Narebski <jnareb@gmail.com>
Date
Jun 23, 2008, 10:01 UTC
Message-ID
<m3ve00lbby.fsf@localhost.localdomain>
In-Reply-To
<485F6710.1080300@mircea.bardac.net>
Mircea Bardac <dev@mircea.bardac.net> writes:
Show 23 quoted lines
> Ian Hilt wrote:
>> On Sun, 22 Jun 2008 at 11:32pm +0100, Mircea Bardac wrote:
>>>
>>> Is there any straightforward way of doing git blame for all the
>>> files that got changed in a commit. Problems are renames, deletes
>>> and copies.
>>
>> Sounds like you want to track files rather than content.  Git tracks
>> the
>> latter.
> 
> Hmm... I'm not really sure that my initial intention was to track
> files. I've given this some more thought and I realized that what I
> actually want is a "git diff" with blame info included. I want this
> information in order to facilitate code reviewing.
> 
> It is true that this would be a front-end functionality, but I am not
> sure at the moment what the best approach would be for something like
> this. I would see this something like
> $ git diff --blame[="parameters_for_blame"] commit1..commit2
> but this is just a thought.
> 
> Has anyone tried blaming a "git diff"?

I think you could script it using "git diff", and "git blame -L m,n", where line ranges would be calculated from git diff header for post-image, or both pre-image and post-image (in the case of deletions).

-- 
Jakub Narebski
Poland
ShadeHawk on #git
Previous: Mircea BardacNext: Ian Hilt
Message 4 of 6 in “git blame for a commit”
  1. Mircea BardacJun 22, 2008
  2. Ian HiltJun 23, 2008
  3. Mircea BardacJun 23, 2008
  4. Jakub NarebskiJun 23, 2008
  5. Ian HiltJun 23, 2008
  6. Jakub NarebskiJun 23, 2008

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.