I recently learned about the --dirstat flag for git diff and found it to be really helpful to gain some insight into changes per directory in a large codebase. I created a simple zsh function:

function git_dir_stat_before() {
  h=`git log --before=$1 | head -n 1 | awk '{print $2}'`
  git diff --dirstat=changes,cumulative,1 $h...master
}

which can be used to calculate stats over a particular timeframe, like this for 2 years of commit history:

git_dir_stat_before 2.years

Previous
Previous

internet commons and the open web

Next
Next