Run this from the root of your repository. Git lists tracked files, while xargs passes them to wc to count their lines. Null-delimited paths keep filenames with spaces intact.
sh
git ls-files -z | xargs -0 wc -lFor a source-only count, filter the tracked paths by extension. This example includes TypeScript and TSX files. Counts include blank lines and comments, and missing working-tree files will produce errors.
sh
git ls-files -z -- '*.ts' '*.tsx' | xargs -0 wc -l