git ls-files
lists files in index, combining it and wc -l
which could count lines, you can get the count of tracked files in Git.
Get count of tracked files
To get count of tracked files, run below command:
# Get count of tracked files in the current directory, including files in its subdirectories
$ git ls-files | wc -l
git ls-files
lists files in the index of the current folder, if a file is removed from the index, it won’t be listed. To get count of all tracked files in the repository, you need to navigate to the root directory of the repository.
git ls-files
git ls-files
lists files in the index of 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 is used to count lines.
Resources
- git -ls-files command
Show information about files in the index and the working tree.