Chizi Victor

_   Count Lines of Code with git

Jun 17, 2025

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

CLIUtility

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

git ls-files | xargs cat | wc -l

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

git ls-files | xargs wc -l