Jumabek Alihanov Jumabek Alihanov - 3 months ago 16
Git Question

How to see untracked files in git instead of untracked directory

My git status shows that following directories (e.g smaller_fc) is untracked.
However, I want to see exactly which file inside that directories (e.g smaller_fc) are untracked.

I know that if git says directory is untracked it means all the files inside the dir is untracked. But I wrote some .gitignore file so now I want to see if it is indeed ignoring certain subdir inside a 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/


Maybe more broader perspective I have .gitignore in my root folder

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


And this is how my root directory looks like

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


Could find it on google.

Answer

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.