Skip to content

Instantly share code, notes, and snippets.

@aaroncampbell
Last active December 11, 2015 21:58
Show Gist options
  • Save aaroncampbell/4666039 to your computer and use it in GitHub Desktop.
Save aaroncampbell/4666039 to your computer and use it in GitHub Desktop.
Measure the added and deleted lines in patches
# For patches, lower numbers are better
function redgreen() {
sed s/'^\(---\|+++\)'// | ack "^[-|\+]" -oh | sort | uniq -c | sed s/"\s*\([0-9]\+\)\s*\([+-]\)"/"\2\1"/ | xargs | awk '{print $2}{print $1}{print "--\r\n"$2 + $1}'
}
# Example usage
# $ svn di | redgreen
# +205
# -506
# --
# -301
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment