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.
git diff --stat 4b825dc642cb6eb9a060e54bf8d69288fbee4904
This shows the differences from the empty tree to your current working tree. Which happens to count all lines in your current working tree.
To get the numbers in your current working tree, do this:
git diff --shortstat `git hash-object -t tree /dev/null`
It will give you a string like 1770 files changed, 166776 insertions(+)
.