Git – List all files currently under source control

gitsource control

Is there a way to list all files currently under source control in git? (Not just those that have been modified).

Best Answer

If you want to list all files for a specific branch, e.g. master:

git ls-tree -r master --name-only

The -r option will let it recurse into subdirectories and print each file currently under version control. You can also specify HEAD instead of master to get the list for any other branch you might be in.

If you want to get a list of all files that ever existed, see here:

git log --pretty=format: --name-only --diff-filter=A  | sort -u