X

Request A Demo

I'm Interested In (select all that apply): 
By submitting this form, I consent to Emplifi Group companies listed in its Privacy Policy processing my information in accordance with its Privacy Policy.
Thank you! We'll be in touch shortly!
Oops! Something went wrong, please try again.
See all posts
Engineering

How to Use `git blame -M` to Trace Code Changes Even if They've Been Moved

The Problem

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):

Pixlee TurnTo Contributor

Pixlee TurnTo welcomes contributed content from leading marketers, influencers and ecommerce experts.

Want to speak to an expert?
Request A Demo
You may also like