LinuxCommandLibrary

git-status

Show the status of the working directory

TLDR

Show changed files which are not yet added for commit

$ git status
copy

Give output in short format
$ git status [[-s|--short]]
copy

Show verbose information on changes in both the staging area and working directory
$ git status [[-vv|--verbose --verbose]]
copy

Show the branch and tracking info
$ git status [[-b|--branch]]
copy

Show output in short format along with branch info
$ git status [[-sb|--short --branch]]
copy

Show the number of entries currently stashed away
$ git status --show-stash
copy

Don't show untracked files in the output
$ git status [[-uno|--untracked-files=no]]
copy

SYNOPSIS

git status [options…] [--] [pathspec…]

PARAMETERS

-s, --short
    Display in compact single-line format.

-b, --branch
    Show branch information, including upstream tracking.

--porcelain[=v2]
    Machine-readable output; v2 is stable format for scripts.

--porcelain=v1
    Legacy machine-readable format (deprecated).

-u[all|normal|no], --untracked-files[=all|normal|no]
    Show untracked files: all (default), normal, or no.

--ignore-submodules[=none|untracked|dirty|all]
    Ignore submodules unless specified (dirty is default).

--ignored
    Display ignored files in untracked section.

--column[=width]
    Display in columns (auto-width if unspecified).

--no-column
    Disable columnar output.

--long
    Long listing format for untracked files.

DESCRIPTION

The git status command displays the current state of the working directory and the staging area (index) in a Git repository. It provides a quick overview of changes, helping users track what files are modified, staged for commit, untracked, or ignored.

By default, output is human-readable and colorized: green for staged changes, red for unstaged modifications, and lists files under sections like 'Changes to be committed', 'Changes not staged for commit', and 'Untracked files'. It also shows the current branch and ahead/behind status relative to upstream.

This command is essential for daily Git workflows, indicating if the working tree is clean or 'dirty'. Options allow customization for scripting or concise views, such as machine-parsable porcelain format. Running git status frequently prevents accidental commits of unwanted changes.

CAVEATS

Output can be verbose in large repositories; use --short or --porcelain for scripts. Does not show diff details—use git diff. Paths after -- treat arguments literally.

EXIT STATUS

0 if working tree clean; 1 if dirty or unmerged; 128 for errors.

COLOR OUTPUT

Enabled by default via color.status config; customizable with color.status.<slot>.

PATHSPEC LIMITING

Specify paths to limit output to specific files/directories.

HISTORY

Introduced in Git 1.0.0 (2005) by Linus Torvalds as core porcelain command. Porcelain v2 added in Git 2.11 (2016) for stable scripting; evolved with submodule and rename detection support.

SEE ALSO

git diff(1), git add(1), git commit(1), git diff-index(1), git ls-files(1)

Copied to clipboard