What is the git status -u command in Git?
The git status command is used to display the current status of the local repository. The information displayed by the git status command includes the name of the branch, the current status of the branch, staged/unstaged changes, etc.
Different options can be used with the git status command to change its default behavior. The complete list of these options can be found here.
The -u option
The -u option is used with the git status command to alter the displayed information related to untracked files and directories.
Syntax
git status -u[mode_name]
or:
git status --untracked-files=mode_name
In the above snippet of code, mode_name is replaced by one of the three available options, altering the displayed information related to the untracked files and folders.
The following table enlists and briefly explains the choices we have for the mode:
Option | Description |
no | Does not display the untracked files and folders. |
normal | Displays the untracked files from the current directory and untracked folders. Does not display the specific untracked files from untracked folders. |
all | Displays all the untracked files and folders, including untracked files that are present in untracked folders. |
Note that there is no space between the
-uoption andmode_nameor--untracked-files=andmode_name.
Example
git status -uall
The command shown in the above snippet of code will display all untracked files from the current working directory and other directories as well.
Free Resources