The best solution, to me anyway, is buried in the comments of @ephemient's answer. I am just pulling it up here so that it doesn't go unnoticed. The credit for this should go to @FRoZeN (and @ephemient).
git diff --shortstat `git hash-object -t tree /dev/null`
returns the total of files and lines in the working directory of a repo, without any additional noise. As a bonus, only the source code is counted - binary files are excluded from the tally.
The command above works on Linux and OS X. The cross-platform version of it is
git diff --shortstat 4b825dc642cb6eb9a060e54bf8d69288fbee4904
That works on Windows, too.
For the record, the options for excluding blank lines,
-w
/--ignore-all-space
,
-b
/--ignore-space-change
,
--ignore-blank-lines
,
--ignore-space-at-eol
don't have any effect when used with --shortstat
. Blank lines are counted.