git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* git blame for a commit
@ 2008-06-22 22:32 Mircea Bardac
  2008-06-23  3:40 ` Ian Hilt
  0 siblings, 1 reply; 6+ messages in thread
From: Mircea Bardac @ 2008-06-22 22:32 UTC (permalink / raw)
  To: git

Hi everyone,

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.

I was also thinking of git diff with a huge number of context lines, but 
this one feels a bit hacking. "git diff" is also missing author info, so 
"git blame" is a bit more desirable.

Has anyone ever done this before?

Many thanks.

-- 
Mircea
http://mircea.bardac.net

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: git blame for a commit
  2008-06-22 22:32 git blame for a commit Mircea Bardac
@ 2008-06-23  3:40 ` Ian Hilt
  2008-06-23  9:04   ` Mircea Bardac
  0 siblings, 1 reply; 6+ messages in thread
From: Ian Hilt @ 2008-06-23  3:40 UTC (permalink / raw)
  To: Mircea Bardac; +Cc: git

On Sun, 22 Jun 2008 at 11:32pm +0100, Mircea Bardac wrote:

> Hi everyone,
> 
> 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.

> I was also thinking of git diff with a huge number of context lines, but this
> one feels a bit hacking. "git diff" is also missing author info, so "git
> blame" is a bit more desirable.
> 
> Has anyone ever done this before?
> 
> Many thanks.

Try "git diff --name-only commit1..commit2" or "git log --name-only
commit1..commit2".  This will give you only the names of the files in
which content was altered.  Other than that, I think you should re-read
(hint) git-blame(1).  It's focus is on content, not files as a whole.


--
Ian Hilt
Ian.Hilt (at) gmx.com
GnuPG key: 0x4AFC1EE3

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: git blame for a commit
  2008-06-23  3:40 ` Ian Hilt
@ 2008-06-23  9:04   ` Mircea Bardac
  2008-06-23 10:01     ` Jakub Narebski
  0 siblings, 1 reply; 6+ messages in thread
From: Mircea Bardac @ 2008-06-23  9:04 UTC (permalink / raw)
  To: Ian Hilt; +Cc: git

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"?

Many thanks.

--
Mircea
http://mircea.bardac.net

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: git blame for a commit
  2008-06-23  9:04   ` Mircea Bardac
@ 2008-06-23 10:01     ` Jakub Narebski
  2008-06-23 15:55       ` Ian Hilt
  0 siblings, 1 reply; 6+ messages in thread
From: Jakub Narebski @ 2008-06-23 10:01 UTC (permalink / raw)
  To: Mircea Bardac; +Cc: Ian Hilt, git

Mircea Bardac <dev@mircea.bardac.net> writes:
> 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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: git blame for a commit
  2008-06-23 10:01     ` Jakub Narebski
@ 2008-06-23 15:55       ` Ian Hilt
  2008-06-23 16:29         ` Jakub Narebski
  0 siblings, 1 reply; 6+ messages in thread
From: Ian Hilt @ 2008-06-23 15:55 UTC (permalink / raw)
  To: Jakub Narebski; +Cc: Mircea Bardac, git

On Mon, 23 Jun 2008 at 3:01am -0700, Jakub Narebski wrote:

> 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).

Maybe I'm missing something, but I thought git-blame only worked with
the files in the Git working directory.  Therefore, if a file had been
deleted it would not be reachable with git-blame, whether you diff'ed
the pre- and post-image or not.


--
Ian Hilt
Ian.Hilt (at) gmx.com
GnuPG key: 0x4AFC1EE3

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: git blame for a commit
  2008-06-23 15:55       ` Ian Hilt
@ 2008-06-23 16:29         ` Jakub Narebski
  0 siblings, 0 replies; 6+ messages in thread
From: Jakub Narebski @ 2008-06-23 16:29 UTC (permalink / raw)
  To: Ian Hilt; +Cc: Mircea Bardac, git

On Mon, 23 Jun 2008, Ian Hilt wrote:
> On Mon, 23 Jun 2008 at 3:01am -0700, Jakub Narebski wrote:
> 
> > 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).
> 
> Maybe I'm missing something, but I thought git-blame only worked with
> the files in the Git working directory.  Therefore, if a file had been
> deleted it would not be reachable with git-blame, whether you diff'ed
> the pre- and post-image or not.

You can give blame the revision to start blaming from; that's what
I meant the "pre-image" blame (staring from parent revision).

I'm not that sure if it is the best solution...
-- 
Jakub Narebski
Poland

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2008-06-23 16:30 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-22 22:32 git blame for a commit Mircea Bardac
2008-06-23  3:40 ` Ian Hilt
2008-06-23  9:04   ` Mircea Bardac
2008-06-23 10:01     ` Jakub Narebski
2008-06-23 15:55       ` Ian Hilt
2008-06-23 16:29         ` Jakub Narebski

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).