Skip to content

Instantly share code, notes, and snippets.

@mhanberg
Last active August 21, 2019 02:20
Show Gist options
  • Save mhanberg/38cd0167127a24ad100d479f734d01b2 to your computer and use it in GitHub Desktop.
Save mhanberg/38cd0167127a24ad100d479f734d01b2 to your computer and use it in GitHub Desktop.
# This function will print out the net lines added
# in your current changes or in a given commit
netlines() {
git --no-pager diff --numstat $1 | awk '{sum += ($1 - $2)} END{print sum;}'
}
$ netlines
-200
$ netlines HEAD~1
31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment