Count number of lines in a git repository

xargs will let you cat all the files together before passing them to wc, like you asked:

git ls-files | xargs cat | wc -l

But skipping the intermediate cat gives you more information and is probably better:

git ls-files | xargs wc -l

Leave a Comment