Getting count of tracked files in Git

Get count of tracked files in Git. Last updated: 2018-12-20

Get count of tracked files:

# Get count of tracked files in the current directory, including files in its subdirectories
$ git ls-files | wc -l

To get count of all tracked files in the repository, remember navigate to the root directory of repository.

ls-files

git ls-files lists all tracked files in the current folder:

# List tracked files
$ git ls-files
my-plugin.php
README.txt
assets/css/style.css
assets/js/my-plugin.js
...

wc

wc means word count, it can be used to count bytes, words, or lines. -l option indicates to count lines.