Getting code statistics

Problem: Get code statistics – a number of added and deleted lines of code, for instance, across annual releases. Git does straightaway via git diff.

git diff --shortstat rel-2010 rel-2011

It prints something like this:

12 files changed, 2462 insertions(+), 488 deletions(-)

If your project isn’t in git, you can quickly import the branches you want to analyse in a temporary git repo.