Take the 2-minute tour ×

Say I start a git repository in a folder, and I have several subdirectories in it.

I have several globbing patterns .gitignore to exclude files in the subdirectories. However, when I do git status before I stage anything, git status only shows the names of the subfolders that will be added, without being specific about which files in each subdirectory will be added (staged) if I do git add ..

Interestingly though, git status is explicit about the files that will be committed after I stage files with git add ..

Is there anyway to ask git status to be explicit about files for the files that would be staged?

share|improve this question

3 Answers 3


git status -u

or the long form:

git status --untracked-files

which will show individual files in untracked directories.

Here's the detailed description of -u option from git-status man page:

enter image description here

share|improve this answer

How about putting a .gitignore file in your sub directories instead along the line of

# Ignore everything in this directory
# Except these file
share|improve this answer
I don't have anything in my .gitignore that looks like what you posted (i.e. ignoring directories or subdirectories with exceptions). Also, why would that matter? By the way, git status returns the list of files that would be committed correctly after staging with git add .. –  user815423426 Oct 2 '12 at 2:27
I know you do not. Remove the directory from the root .gitignore and add this .gitignore in your sub directory - you can have more than one. They nest –  Adrian Cornish Oct 2 '12 at 2:31

git ls-files -o --exclude-standard

Every path in your worktree that isn't staged (-o) and won't be ignored by git add (--exclude-standard).

share|improve this answer

Your Answer


