Skip to content

Instantly share code, notes, and snippets.

@zwhitchcox
Last active June 10, 2018 03:12
Show Gist options
  • Save zwhitchcox/76521d0e275efa50f39c6cde2939dc09 to your computer and use it in GitHub Desktop.
Save zwhitchcox/76521d0e275efa50f39c6cde2939dc09 to your computer and use it in GitHub Desktop.
show total amount of lines added or removed from git repository without yarn.lock or package-lock.json
# total lines removed
git log --numstat --pretty="" | grep -v lock | sed -r -e "s/^([0-9]+)\\s+([0-9]+).*/\2/" | grep -v "^-" | paste -sd+ | bc
# total lines added
git log --numstat --pretty="" | grep -v lock | sed -r -e "s/^([0-9]+)\\s+([0-9]+).*/\2/" | grep -v "^-" | paste -sd+ | bc
# the main thing to edit would be git log. You could change this to whatever author you like or over
# whatever time frame or between two commits, etc. The `grep -v lock` removes all files like yarn.lock
# or package-lock.json, which is the main reason I created this command, because those files added like 40,000
# line changes to my code. Also the `grep -v "^-"`removes `png` files and such that are not countedl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment