List files which are and are not under version control

To get a list of all the files which are under version control,

git ls-files

To list the files in or under the current directory which are not under version control, which are deliberately being ignored using .gitignore, for example object (*.o) files, use

git ls-files --others --ignored --exclude-from=.gitignore 
git clean -Xn

See Show ignored files in git.

Copyright © Ben Bullock 2009-2023. All rights reserved. For comments, questions, and corrections, please email Ben Bullock ( or use the discussion group at Google Groups. / Privacy / Disclaimer