Last Updated: February 25, 2016
·
538
· zabolotnov87

Total lines of code

Problem

Suppose we need to know total lines of code for our git repo

Solution

git ls-files | xargs file | awk 'BEGIN { FS = ":" } ; $2~/text$/ {print $1}' | xargs cat | sed '/^\s*$/d' | wc -l

2 Responses
Add your response

Another way to do this https://coderwall.com/p/ap8i-w

over 1 year ago ·

It would be better if we could exclude the libraries from this count. For eg: JS libraries that you didn't write.

over 1 year ago ·