You can get files in a directory using git ls-tree .
Here I write the output of git ls-tree
to a file.
$ for branch in $(git for-each-ref --format='%(refname)' refs/heads/); do git ls-tree -r --name-only $branch <directory> >> file-list ; done
You can get unique files:
sort -u file-list
pratZ source share