Skip to main content

Synopsis

git status [<options>] [--] [<pathspec>...]

Description

Displays paths that have differences between the index file and the current HEAD commit, paths that have differences between the working tree and the index file, and paths in the working tree that are not tracked by Git (and are not ignored by gitignore). The first are what you would commit by running git commit; the second and third are what you could commit by running git add before running git commit.

Common Usage

1

Check repository status

View the current state of your working directory:
git status
2

Use short format

Get a condensed status output:
git status -s
3

Check specific paths

View status for specific files or directories:
git status src/
4

View branch information

Show branch and tracking info even in short format:
git status -sb

Options

-s, --shortGive the output in the short-format.-b, --branchShow the branch and tracking info even in short-format.--longGive the output in the long-format. This is the default.--porcelain[=<version>]Give the output in an easy-to-parse format for scripts. This is similar to the short output, but will remain stable across Git versions and regardless of user configuration.-zTerminate entries with NUL, instead of LF. This implies the --porcelain=v1 output format if no other format is given.
-v, --verboseIn addition to the names of files that have been changed, also show the textual changes that are staged to be committed (i.e., like the output of git diff --cached). If -v is specified twice, then also show the changes in the working tree that have not yet been staged.--show-stashShow the number of entries currently stashed away.
-u[<mode>], --untracked-files[=<mode>]Show untracked files. The mode parameter is used to specify the handling of untracked files:
  • no - Show no untracked files
  • normal - Show untracked files and directories (default)
  • all - Also show individual files in untracked directories
When -u option is not used, untracked files and directories are shown (i.e. the same as specifying normal).
--ignored[=<mode>]Show ignored files as well. The mode parameter is optional and defaults to traditional:
  • traditional - Show ignored files and directories
  • no - Show no ignored files
  • matching - Show ignored files and directories matching an ignore pattern
--ignore-submodules[=<when>]Ignore changes to submodules when looking for changes. The when parameter can be:
  • none - Consider the submodule modified when it contains untracked or modified files or its HEAD differs
  • untracked - Submodules are not considered dirty when they only contain untracked content
  • dirty - Ignore all changes to the work tree of submodules
  • all - Hide all changes to submodules (default)
--column[=<options>], --no-columnDisplay untracked files in columns. --column and --no-column without options are equivalent to always and never respectively.--ahead-behind, --no-ahead-behindDisplay or do not display detailed ahead/behind counts for the branch relative to its upstream branch. Defaults to true.--renames, --no-renamesTurn on/off rename detection regardless of user configuration.--find-renames[=<n>]Turn on rename detection, optionally setting the similarity threshold.

Output Format

Short Format

In the short-format, the status of each path is shown as:
<xy> <path>
<xy> <orig-path> -> <path>
Where <xy> is a two-letter status code:
CodeMeaning
??Untracked
!!Ignored
M Modified in index
MModified in working tree
MMModified in both index and working tree
A Added to index
D Deleted from index
DDeleted in working tree
R Renamed in index
C Copied in index
U Updated but unmerged

Long Format

The default long format is designed to be human readable and verbose:
On branch main
Your branch is up to date with 'origin/main'.

Changes to be committed:
  (use "git restore --staged <file>..." to unstage)
	modified:   file1.txt
	new file:   file2.txt

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
	modified:   file3.txt

Untracked files:
  (use "git add <file>..." to include in what will be committed)
	file4.txt

Examples

Basic status check

$ git status
Shows the working tree status in the default long format.

Short format with branch info

$ git status -sb
## main...origin/main
 M file1.txt
A  file2.txt
 M file3.txt
?? file4.txt

Show ignored files

$ git status --ignored
Displays ignored files in addition to the regular status output.

Compact output without untracked files

$ git status -s -uno
 M file1.txt
A  file2.txt
 M file3.txt

Verbose output showing diffs

$ git status -v
Shows the status plus the diff of staged changes.

Check specific directory

$ git status src/
Shows status only for files within the src/ directory.

Performance Considerations

git status can be very slow in large worktrees if/when it needs to search for untracked files and directories. Several options can help:
  • --untracked-files=no - Don’t show untracked files (fastest option)
  • core.untrackedCache=true - Enable the untracked cache feature to speed up untracked file detection
  • core.fsmonitor=true - Use FSMonitor to track filesystem changes
For large repositories, consider using:
$ git --no-optional-locks status
This prevents lock conflicts when running status in the background.
  • git add - Add file contents to the index
  • git commit - Record changes to the repository
  • git diff - Show changes between commits, commit and working tree, etc
  • git reset - Reset current HEAD to the specified state