How to see untracked files in git instead of untracked directory

Jumabek Alikhanov picture Jumabek Alikhanov · Aug 19, 2016 · Viewed 21.1k times · Source

git status shows directory (e.g smaller_fc) is untracked. However, I want to see exactly which files inside the directories (e.g smaller_fc) are untracked.

I would like to know if .gitignore is indeed ignoring certain subdir inside smaller_fc dir.

Here is terminal output.

$ git status On branch master Your branch is ahead of 'origin/master' by 1 commit. (use "git push" to publish your local commits)

Changes not staged for commit: (use "git add ..." to update what will be committed) (use "git checkout -- ..." to discard changes in working directory)

modified:   .gitignore

Untracked files: (use "git add ..." to include in what will be committed)

nets/models/500K_iterations/500K_iteration_eval.txt
nets/models/from_solverstate_150K/
nets/models/pretrained_model/
nets/models/smaller_fc/

.gitignore file:

.cproject
.project
.pydevproject
build
*~
*.pyc
*.caffemodel
*/solverstate/*

directory structure:

root
-models
--model1
---solverstate
----somefiles.txt
--model2
---solverstate
----anotherfiles.txt
.gitignore

Could not find it on google.

Answer

mipadi picture mipadi · Aug 19, 2016

If git only shows that the directory is untracked, then every file in it (including files in subdirectories) is untracked.


If you have some ignored files in the directory, pass the -u flag when running git status (i.e., git status -u) to show the status of individual untracked files.