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
| Flag | What it does |
|---|---|
| -s / --short | Compact one-line-per-file output |
| -b / --branch | Show 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
git add: Usage, Options & Common CI Errorsgit add stages changes for the next commit. Reference for -A, -p, --update, and the pathspec and ignored-file…
git commit: Usage, Options & Common CI Errorsgit commit records staged changes as a new commit. Reference for -m, --amend, --no-verify, and the empty-comm…
git diff: Usage, Options & Common CI Errorsgit diff shows changes between commits, the index, and the working tree. Reference for --staged, --name-only,…
git log: Usage, Options & Common CI Errorsgit log shows commit history with flexible formatting. Reference for --oneline, --graph, --pretty, ranges, an…