2.33. Who Changed Which Line?

TortoiseGit

2.33. Who Changed Which Line?

Sometimes you need to know not only what lines have changed, but also who exactly changed specific lines in a file. That's when the TortoiseGitBlame... command, sometimes also referred to as annotate command comes in handy.

This command lists, for every line in a file, the author and the revision the line was changed.

2.33.1. Blame for Files

By default the blame file is viewed using TortoiseGitBlame, which highlights the different revisions to make it easier to read.

Figure 2.65. TortoiseGitBlame

TortoiseGitBlame

TortoiseGitBlame, which is included with TortoiseGit. When you hover the mouse over a line in the blame info column, all lines with the same revision are shown with a darker background. Lines from other revisions which were changed by the same author are shown with a light background. The colouring may not work as clearly if you have your display set to 256 colour mode.

If you left click on a line (on the blame info column on the left), all lines with the same revision are highlighted, and lines from other revisions by the same author are highlighted in a lighter colour. This highlighting is sticky, allowing you to move the mouse without losing the highlights. Click on that revision again to turn off highlighting.

The revision comments (log message) are shown in a hint box whenever the mouse hovers over the blame info column. If you want to copy the log message for that revision, use the context menu which appears when you right click on the blame info column.

If you need a better visual indicator of where the oldest and newest changes are, select ViewColorise by age, continous. Then the background color intensity of the lines is related to its age. This will use a colour gradient to show newer lines in yellow and older lines in white. The default colouring is quite light, but you can change it using the TortoiseGitBlame settings.

Please also check out the View menu. There you can toggle the Ignore whitepace and also toggle the detection of moved/copied lines from other files and Follow renames.

You can search within the Blame report using EditFind.... This allows you to search for revision numbers, authors and the content of the file itself. Log messages are not included in the search - you should use the Log Dialog to search those.

You can also jump to a specific line number using EditGo To Line....

When the mouse is over the blame info columns, a context menu is available which helps with comparing revisions and examining history, using the commit of the line under the mouse as a reference. Context menuBlame previous revision generates a blame report for the same file, but using the previous revision as the upper limit. This gives you the blame report for the state of the file just before the line you are looking at was last changed. Context menuShow changes starts your diff viewer, showing you what changed in the referenced revision of the file. Please note, however, that these two options are only available if this line is not there since the initial comit of the file. Context menuShow log displays the revision log dialog starting with the referenced revision.

The settings for TortoiseBlame can be accessed using TortoiseGitSettings... on the TortoiseGitBlame tab. Refer to Section 2.36.8, “TortoiseGitBlame Settings”.

You can find more information at Section G.3.9, “git-blame(1)”.