robertoandres24
4/25/2018 - 2:54 PM

A Git alias to display the total number of insertions and deletions.

A Git alias to display the total number of insertions and deletions.

# Usage: git total [OPTION...]
#
# Options:
#
#   In theory, the command accepts all command line options supported by
#   the "git log" command. In reality, however, only few commit-limiting
#   options are useful. This includes:
#
#   --author=PATTERN, --committer=PATTERN
#       Displays the number of lines changed by a certain author.
#
#   --since=DATE, --after=DATE
#       Counts only commits that are more recent than a specific date.
#
#   --until=DATE, --before=DATE
#       Counts only commits that are older than a specific date.
#
#   -n NUMBER, --max-count=NUMBER
#       Counts only a certain number of commits.
#
# Examples:
#
#   git total
#       Displays the total number of changes.
#
#   git total --author=john@example.com
#       Displays the total number of changes by john@example.com.

[alias]
	total = "!f() { git log $@ --numstat | perl -ne '$i+=$1 and $d+=$2 if /^(\\d+)\\s+(\\d+)/; END { print \"$i insertion(s), $d deletion(s)\n\"}'; }; f"