0 votes
1 view
in Devops and Agile by (25.5k points)

How would I count the total number of lines present in all the files in a git repository?

git ls-files gives me a list of files tracked by git.

I'm looking for a command to cat all those files. Something like

git ls-files | [cat all these files] | wc -l

1 Answer

0 votes
by (42.6k points)

For this question, xargs will help you to count the number of lines in a git repository.

Let’s see how this works

git ls-files | xargs cat | wc -l

For more information you better use

git ls-files | xargs wc -l

 This will count the number of lines in a git repository.

Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...