Created
October 8, 2020 03:22
-
-
Save bundit/4bc42a57f18b2ef455fd0a4376cd3c14 to your computer and use it in GitHub Desktop.
Count lines of code a git tracked project
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Referenced from https://gist.github.com/mandiwise/dc53cb9da00856d7cdbb | |
// List line count of all tracked files | |
$ git ls-files | xargs wc -l | |
// Match only certain file-types | |
$ git ls-files -- '*.js*' | xargs wc -l | |
// Add additional file-types to count | |
$ git ls-files -- '*.js*' '*.jsx' '*.tsx' '*.css' | xargs wc -l | |
// Ignore file-types | |
$ git ls-files -- ':!:*.json' | xargs wc -l | |
// Only return total lines of code | |
$ git ls-files -- '*.js*' '*.jsx' '*.tsx' '*.css' ':!:*.json' | xargs cat | wc -l |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment