How to Use `git blame -M` to Trace Code Changes Even if They've Been Moved
git blame is a useful tool for tracing where changes code came from. But sometimes code gets moved around in a file or even to a completely different file, which can make it difficult to follow a change’s path through history. This is because git blame only looks at the most recent change to that line. In the case where that line of code was just moved to a different place in the file, it’ll just look like the line was added, and there just so happens to also be an equal and opposite delete change in that commit.
So for example, if I have a file like this (with comments to indicate what the git blame output would look like for that line):