- Published: January 2, 2016
If you create a directory in a repo and start adding files, when you check the repository status with git status, by default it will just list the new directory and not its files.
Using a special parameter in
git status we can see all the files
in the new directory we want to stage.
Seeing untracked files
git status has the
untracked-files switch where we select which
files to see each time we execute
The mode parameter is used to specify the handling of untracked files. It is optional: it defaults to all, and if specified, it must be stuck to the option (e.g. -uno, but not -u no). The possible options are: no - Show no untracked files. normal - Shows untracked files and directories. all - Also shows individual files in untracked directories.
--untracked-files=all we see all the files in new
I will create a new directory with some untracked files to see its behaviour:
$ mkdir new_feature $ touch new_feature/feature_a $ touch new_feature/feature_b $ git status On branch master Initial commit Untracked files: (use "git add <file>..." to include in what will be committed) new_feature/ nothing added to commit but untracked files present (use "git add" to track)
Showing untracked files
git status untracked-files=all:
$ git status --untracked-files=all On branch master Initial commit Untracked files: (use "git add <file>..." to include in what will be committed) new_feature/feature_a new_feature/feature_b nothing added to commit but untracked files present (use "git add" to track)
Now we can stage new files directly.
Setting as the default behaviour
To save this setting, we use
git config --global
status.showuntrackedfiles all so it will add the following to git
[status] showuntrackedfiles = all
Or we can just add the above code manually to