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-tree makes the command run as if you were in the repo’s root directory.
  • -r recurses into subdirectories. Combined with --full-tree this gives you all committed, tracked files.
  • --name-only removes SHA / permission info for when you just want the file paths.
  • HEAD specifies which branch you want the list of tracked, committed files for. HEAD is the pointer for the commit you have checked out currently.

And the output will be like:

...
static/img/logopal.png
static/img/logos/bitcoin.png
static/img/logos/bmc-button.svg
static/img/logos/django-logo.png
static/img/logos/git-logo-full.png
static/img/logos/git-logo-red.png
static/img/logos/git-logo-white.png
static/img/logos/neovim-logo.png
static/img/logos/python-logo.png
static/img/logos/python-logo2.png
static/img/logos/python-logo3.png
static/img/logos/python-logo4.png
static/img/logos/python-logo5.png
static/img/logos/python-logo6.png
static/img/logos/python-logo8.svg
static/img/logos/vim-logo.png
static/img/python3.7-default.jpg
static/img/safari-pinned-tab.svg
...

If you want to show the files on the master branch, replace HEAD with master:

$ 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'

All done!

References: