Git Blame Can Do More

Published about 1 month ago • 1 min read

Hi Friends,

Today, we’re diving into the often under-appreciated git blame.

Often used to find out who last modified a line of code, git blame has several powerful features. Let’s explore some of these hidden gems, particularly focusing on the flags:

  • -w
  • -C
  • -C -C
  • -C -C -C

Ignoring Whitespace with the -w Flag

Do you know the annoying blame results showing over an indent or a space removed / added?
"-w" fixes that!

git blame -w file_name

And you got yourself a clean blame with the real authors of changes.

Ignoring Code Movements With -C Flag

The -C flag takes it a step further. It detects lines that were copied or moved from other files in the repository!
This is particularly useful in large projects where code refactoring and file splitting or merging are common:

git blame -C file_name

To extend the detective work, using -C -C instructs Git to examine not just the target blame file but also to look at other potential sources in the repository:

git blame -C -C file_name

The double -C makes git blame even more robust against file shifts and reorganizations, tracking down code origins through multiple levels of file history.

Maximum Traceability with -C -C -C

Finally, -C -C -C expands the search scope to its maximum:

git blame -C -C -C file_name

Triple -C helps in scenarios where significant portions of a codebase have been moved around multiple times, potentially across multiple files over an extended period. It ensures that you can trace back to the initial commits affecting the current state of any line of code.

git blame is more than just a tool for finding who wrote a line of code; it’s a gateway to the history and evolution of your project. I’ve been using it extensively recently and learned a lot about changes made over periods of time.

Since many code changes are 'obfuscated' over time because of small changes, formatters, and re-orgs, we're left with a hard-to-follow chain of events. Knowing how to remove these layers has been super helpful trying to understand code authors and why/how things were done.

Thanks for reading, have a great weekend!

Whenever you’re ready, here’s how I can help you


Every once in a while I send hand picked things I've learned. Kind of like your filter to the tech internet. No spam, I promise!


Hi friends! This week, I want to delve into a topic that many of us overlook: typing. Often, people just wing it with whatever typing habits they’ve developed over time. But it doesn’t have to be this way. Mastering fast typing and knowing the keyboard by heart can make everything quicker, more productive, and fun. It allows for better focus and significantly improves the quality of work. Touch Typing The first step in adopting the right system is touch typing. Learning touch typing is...

1 day ago • 1 min read

Hi frieds, The question posed in the title is likely the one that keeps many developers and engineering leaders up at night these days. The short answer is no. I recently came across two fascinating blog posts about AI’s impact on software development. The first was from the renowned “The Pragmatic Engineer” blog, and the second from Sequoia Capital, a major venture capital firm with investments in giants like Google, Apple, and Oracle. Here’s a brief rundown of the key insights: Ask any CEO...

9 days ago • 2 min read

Focus is a huge problem in modern days. These days, lots of apps and websites try to grab our attention and keep us hooked. Most of us know we should resist these distractions. But instead of making a plan, many people just wing it. I used to do that too. But I’ve had enough. Another Instagram post, YouTube short, or funny meme won’t make me feel good about my day. In fact, they: Make my workday longer. Slow down my progress, bit by bit. So, I put together some tools and rules to help me stay...

16 days ago • 3 min read
Share this post