Count Changed Lines in Git

I have a favourite set of switches to git log, but today I wanted to answer the question “You deleted how much code today?” so I thought I’d share how I did that

git log --numstat will show you how many lines were added (first column) and removed (next column) per file, kind of a more scientific version of the --stat switch. And if you’re thinking of scripting this to gather stats, try it with --oneline as well, it’s easier to parse.

Leave a Reply

Please use [code] and [/code] around any source code you wish to share.

This site uses Akismet to reduce spam. Learn how your comment data is processed.