Skip to content
Latchkey

git status: Usage, Options & Common CI Errors

git status tells you what is staged, what is changed, and how your branch relates to its upstream.

Status is your orientation tool. The --porcelain format is the stable one to parse in scripts.

What it does

git status reports the state of the working tree and index: staged changes, unstaged changes, untracked files, and whether the branch is ahead/behind its upstream.

Common usage

Terminal
git status
git status -sb                # short + branch line
git status --porcelain        # stable, script-friendly output
# gate a commit on real changes:
[ -n "$(git status --porcelain)" ] && git commit -am "update"

Options

FlagWhat it does
-s / --shortCompact one-line-per-file output
-b / --branchShow branch and tracking info
--porcelain[=v1|v2]Stable machine-readable format
-u<mode>Control untracked-file detail (no/normal/all)

Common errors in CI

A frequent mistake is parsing the human-readable output, which is localized and can change. Always parse --porcelain in scripts. An empty --porcelain result is the reliable signal that there is nothing to commit.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →