The git status
command displays the state of the working directory and the staging area. It shows you which changes have been staged, which have not, and which files are not being tracked by Git.
Initial Example
To check the status of your working directory, use:
git status
STATUS Options
Option | Description |
---|---|
-s, --short | Display the output in a short format. |
-b, --branch | Show branch and tracking information even in short format. |
--show-stash | Display the number of stashed entries. |
--porcelain[=<version>] | Provide output in a stable format suitable for scripts. Defaults to version v1. |
--long | Display the output in the long format (default). |
-v, --verbose | Show detailed changes staged for commit. |
-u[<mode>], --untracked-files[=<mode>] | Show untracked files. Modes: no , normal , all . |
--ignore-submodules[=<when>] | Ignore changes to submodules. Options: none , untracked , dirty , all (default). |
--ignored[=<mode>] | Show ignored files. Modes: traditional , no , matching . |
-z | Terminate entries with a NUL character instead of LF. |
--column[=<options>], --no-column | Display untracked files in columns. Options: always , never . |
--ahead-behind, --no-ahead-behind | Show or hide detailed ahead/behind counts for the branch relative to its upstream branch. |
--renames, --no-renames | Turn rename detection on or off, regardless of user configuration. |
--find-renames[=<n>] | Enable rename detection with an optional similarity threshold. |
<pathspec>... | Limit status output to paths matching the specified pathspec. |
Examples
1. Checking the Status
Running the command will display information about changes to be committed, changes not staged for commit, and untracked files:
git status
2. Short Status
For a more concise output, you can use the -s
or --short
option:
git status -s
3. Branch Information
To include information about the branch you’re on, use the -b
or --branch
option:
git status -b