A crucial ⚡ metric for your team to track.
- Nikolay Miroshnychenko
- May 23, 2024
- 1 min read

A crucial ⚡ metric for your team to track is code churn. It allows you to identify places in your codebase that get changed the most. Why is that important? 🤔
Such places indicate that there is an issue. Code points that have high churn rates are usually problematic hence the frequent "adjustments".
Refactoring such spots is important. But how can you identify them?
Tools like LinearB, Opsera, Metridev, and others allow you to track this metric. However, you can do it for free! Recently a teammate of mine showed me that you can do that via git.
Just run the following command in your project:
git log --pretty=format: --since="1 year ago" --name-only -- "*.kt" | sort | uniq -c | sort -rg | head -5
Specify how far back you want to "look" by adjusting the `--since` option.
Tune how many files you want to see by changing the number at the end. In my example, it's `5`.
Run this command and you'll be able to see something similar as in the picture below. On the left, you'll have the amount of commits to a certain file. On the right, you'll see the names of the files.
Thanks for reading!
Comments