CLIUtility

Count Lines of Code with git

Get the lines of code (LOC) count in a git repository using the cli

Jun 17, 2025

xargs will let you cat all the files together before passing them to wc. The wc (word count) command displays the number of lines.

sh
git ls-files | xargs cat | wc -l

Skipping the intermediate cat gives you more information and might be more useful sometimes:

sh
git ls-files | xargs wc -l