'Git: How do I calculate the number of times a line has changed?

I'm trying to get the churn, or the number of times a line of code has changed. I've seen various approaches to do this with files, but how can I do it with a single line?

Using git log and numstat we can do something like

git log --numstat --pretty="%H" --after=2022-05-01 

It's useful, but it does it at the file level. How can I do it at the line/code block level?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source