[git-users] Re: git blame help

2010-12-30 Thread Thomas Ferris Nicolaisen
Just to play the voice of logic here, I think it would be hard to define 
when a line is introduced vs. changed, as you could say that entering a new 
line is the same as changing an empty line. 

An algorithm for finding the difference would have to include some sort of 
fuzzy consideration of the diffs, to interpret whether a changed line is 
new, or an existing line moved to a new location. I imagine it would never 
be an exact algorithm, very hard to implement, and also 
performance-intensive. The stuff (pickaxe) you've already found is the 
closest you'll get, I believe. Note that there are more options, like 
searching with regexp, if you look at the docs.

You can also go manually looking for the rev like this:
1) git blame [file]
2) pick a line
3) Copy the sha of the line (last changed rev)
4) git blame [sha]^ [file]

You now will get blame on the file *before* last change on that line. Now 
you decide if the line was "already there, but different", you copy the 
(new) sha of the line again, and repeat the process until you find the 
version of the file before the line was introduced.

The hat "^" means "parent of", so you are basically printing/blaming the 
version before the one of the sha specified.

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To post to this group, send email to git-us...@googlegroups.com.
To unsubscribe from this group, send email to 
git-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/git-users?hl=en.



[git-users] Re: git blame help

2010-12-30 Thread Dread Pirate Niko
I've found one method using: git log -S "unique string in line" which 
displays logs only for lines where this string matches the line in the 
commit changes. This is ok for now, but I would prefer a more absolute 
method for finding out when a line was introduced.

-Niko

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To post to this group, send email to git-us...@googlegroups.com.
To unsubscribe from this group, send email to 
git-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/git-users?hl=en.