This is another one where I can't seem to find the answer on Google. My issue goes like this...

Background: Until recently, we used TFS for our version control. We recently switched to Git. In the past, if I wanted to see who was responsible for a particular code edit, I would load up that code in Visual Studio, right-click on it, and select "Source Control/Annotate".

It would show a list, in the left column, of the most recent person to modify each line of code.

Now that we are on Git, it does the very same thing: pressing "Source Control/Annotate" still obtains the most recent person to have modified each line of code. So far so good. Now I want to do the same thing at the command line for automation purposes. I'm using "Git Blame" which is the same thing as "Git Annotate" with slight formatting differences. For the purposes of discussing my issue, both of these commands produce the same output, including the same issue.

The issue is:
- The resulting list of names in Visual Studio is different from the list of names in Git Blame. I like the one in Visual Studio better and I want to make Git Blame work like Visual studio does.

Here is a more detailed description:

- There are the normal modifications to the files, line-by-line, day by day. Dick changes line 4 in february. Jane changes line 5 in march. Etc. History is there, all is well. The names show up correctly in both Git Blame and in Visual studio, output is the same.

- Then in April, Bob comes along and re-encodes the entire file from UTF-16 down to UTF-8.

- This is where things diverge. In Visual studio, it still correctly shows that Dick was the last person to change line 4, and Jane was the last person to change line 5. However, Git Blame says the entire file is now Bob's file, he has changed every line in the file.

- For similar situations in the past, sometimes using the parameter "-w" (ignore whitespace) to Git Blame helps with this kind of issue a little bit. But for this particular case (the UTF-16->UTF-8 conversion) it's not helping.

- I have tried every parameter to Git Blame that is shown in the Git Blame docs, and nothing changes it. Doing Git Annotate instead doesn't change it. Every time I still have the same issue.

- I understand that Git Blame is being technically correct here, but it's not being "nice". It's only useful to see who actually made functional changes to the code, not just who reformatted it. Visual studio does just fine for this, showing me exactly what I need to see, so I know that somehow this must be do-able. I need Git Blame to act the same, in order to become a successful part of my automation flow.

- I assumed that Visual Studio was just running Git Blame under the hood when you pressed Annotate. It's not. It's apparently using LibGit2: https://libgit2.github.com/ and some custom code. Whatever Visual studio is doing, that's what I want to do. I don't know what it is, though, and I don't know how to find out.

So my questions:
- Anyone know what Visual Studio is doing to get me the "nicer" version of the results?
- Anyone know what tricky command line stuff I can use in Git that'll get me the same results?

Thanks!
_________________________
Tony Fabris