List all files tracked by Git
Sometimes you need a list of all files tracked by Git—for example, when using tools like entr
to watch files for changes. Instead of fiddling with find
, Git provides a clean and concise command git-ls-files:
git ls-files
This lists all files in the repository that are tracked by Git.
Other tips
Include ignored files:
git ls-files --others --ignored --exclude-standard
Filter by file type:
git ls-files '*.js' # List only JavaScript files
Use with
entr
to watch files:git ls-files | entr -r your-command