Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git status not showing contents of newly added folder

Tags:

git

I just created a new git repo at / I created a new filetest.txt in the folder test_fold so that the path to the file is test_fold\test.txt. I then run git status. This is the output, it finds the folder but not the file. Why is not showing me that there is a new file in test_fold?

$ git status On branch master  Initial commit  Untracked files:   (use "git add <file>..." to include in what will be committed)          .gitignore         test_fold/  nothing added to commit but untracked files present (use "git add" to track) 

The .gitignore file is blank.

like image 472
Vader Avatar asked Jan 29 '15 19:01

Vader


1 Answers

Git will ignore the content of a folder if the folder doesn't already contain tracked paths. You know by the presence of test_fold/ that there are files in there (Git will never show you an empty directory as being untracked) and you know that those files are not tracked.

Otherwise, unzipping a folder into your repository could potentially introduce huge amounts of output from git status. The default behavior of simply showing the top-level untracked path makes for much saner output.

If you want Git to show you the content of the folder, use

$ git status -uall 

This will show you test_fold/test.txt (and any other files) instead of just test_fold/.

like image 54
meagar Avatar answered Oct 09 '22 09:10

meagar