Skip to content

Instantly share code, notes, and snippets.

@thevangelist
Last active January 12, 2018 11:31
Show Gist options
  • Save thevangelist/48cc0855bc6df50f16edf6d282b172cc to your computer and use it in GitHub Desktop.
Save thevangelist/48cc0855bc6df50f16edf6d282b172cc to your computer and use it in GitHub Desktop.
Git diff --stat with exclude files

// Just the exclude diff lines changed git diff --stat master -- ':(exclude)*package-lock.json'

// Detailed output on changed lines count

git log --author="<esa.ase@gose.com>" --pretty=tformat: --numstat -- ':(exclude)*package-lock.json' | awk '{inserted+=$1; deleted+=$2; delta+=$1-$2; ratio=deleted/inserted} END {printf "Commit stats:\n- Lines added (total)....  %s\n- Lines deleted (total)..  %s\n- Total lines (delta)....  %s\n- Add./Del. ratio (1:n)..  1 : %s\n", inserted, deleted, delta, ratio }' -

// Output example

Commit stats:
- Lines added (total)....  7882
- Lines deleted (total)..  3919
- Total lines (delta)....  3963
- Add./Del. ratio (1:n)..  1 : 0.497209
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment