Skip to content

Instantly share code, notes, and snippets.

@chr15m
Last active January 14, 2022 02:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chr15m/6840e81cf1b7eafbf7ffe051f77ed833 to your computer and use it in GitHub Desktop.
Save chr15m/6840e81cf1b7eafbf7ffe051f77ed833 to your computer and use it in GitHub Desktop.
Count lines of code in your git repo
#!/bin/sh
# Count the lines of source code checked into your repository
# Requires the `cloc` command as a dependency.
# You can pass extra arguments to cloc like this:
# git cloc --exclude-dir=build --exclude-ext=js
git ls-tree -r `git branch | grep '^*' | colrm 1 2` --name-only | sed 's/.*/"&"/' | xargs cloc "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment