JvB
Photo

Jeroen van Baarsen

August 22, 2017
Use git blame more efficient

Everyone has been there, that piece of code of which you think: “Wow what a piece of crazy code, the person who wrote that should be ashamed” (Ofcourse it wasn’t you! It’s never you!) or maybe you’re more positive minded and you think: “Thats a nice piece of code, who made this?”

The tool you are most likely to use is git blame.

With git blame comes one little issue, it gives a lot of false positives, for example: someone moved the piece of code around, or removed a trailing whitespace. All those actions will cause the git blame to point to them.

To make sure you only get the person who changed the code itself (not whitespaces or other trivial changes), you can use the following flags bash $ git blame -w # Ignore whitespaces $ git blame -M # Ignore moving text $ git blame -C # Ignore text that has moved from another file