count lines of code in github repo 1

count lines of code in github repo

git ls-files | xargs wc -l

Here is what the above code is Doing:
1. git ls-files lists all the files in the current directory that are tracked by git.
2. xargs wc -l takes the output of the previous command and runs wc -l on each line.
3. wc -l counts the number of lines in each file.
4. The output of the previous command is piped to sort -n, which sorts the output numerically.
5. The output of the previous command is piped to tail -n 1, which prints the last line of the output.

Similar Posts