Skip to content

Instantly share code, notes, and snippets.

@e4coder
Forked from mandiwise/Count lines in Git repo
Created June 10, 2025 17:08
Show Gist options
  • Save e4coder/f8321942454357acf2cb0bcdd7a27921 to your computer and use it in GitHub Desktop.
Save e4coder/f8321942454357acf2cb0bcdd7a27921 to your computer and use it in GitHub Desktop.
A command to calculate lines of code in all tracked files in a Git repo
// Reference: http://stackoverflow.com/questions/4822471/count-number-of-lines-in-a-git-repository
$ git ls-files | xargs wc -l
@e4coder
Copy link
Author

e4coder commented Jun 10, 2025

git ls-files --exclude-standard -- ':!:**/*.[pjs][npv]g' ':!:**/*.ai' ':!:.idea' ':!:**/*.eslintrc' ':!:package-lock.json' | xargs wc -l

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment