One minute read
All current files
In order to show all of the tracked files that have been committed on the current branch, run:
$ git ls-tree --full-tree --name-only -r HEAD
--full-treemakes the command run as if you were in the repo’s root directory.
-rrecurses into subdirectories. Combined with
--full-treethis gives you all committed, tracked files.
--name-onlyremoves SHA / permission info for when you just want the file paths.
HEADspecifies which branch you want the list of tracked, committed files for.
HEADis the pointer for the commit you have checked out currently.
And the output will be like:
If you want to show the files on the
master branch, replace
$ git ls-tree --full-tree --name-only -r master
Probably you also want a alias for that:
alias gtf='git ls-tree --full-tree --name-only -r HEAD'
All files including deleted
If you want to list all of files that ever existed including deleted files, run below:
$ git log --pretty=format: --name-only --diff-filter=A | sort - | sed '/^$/d'