Git 2 reference · Basics

git status Command (Git)

Show which files are staged, modified or untracked, and how the branch relates to its upstream.

Git 2

Create a free account to save this page, take notes and track your progress. Sign in

Syntax

git status [-s] [-b]

Parameters

ParameterDescription
-s Short format: XY status codes per file.
-b Include the branch line in short format.

Examples

Short format: staged, modified, untracked
git init -q -b main app && cd app
echo '# Shop' > README.md
git add README.md && git commit -q -m 'Initial commit'
echo 'v2' >> README.md; echo x > new.txt; echo y > staged.txt; git add staged.txt
git status -s

Output

 M README.md
A  staged.txt
?? new.txt

Run this on your computer — see “Get Started” for setup.

A clean working tree
git init -q -b main app && cd app
echo '# Shop' > README.md
git add README.md && git commit -q -m 'Initial commit'
git status | head -2

Output

On branch main
nothing to commit, working tree clean

Run this on your computer — see “Get Started” for setup.

In short format the first column is the staged state and the second the working-tree state: M staged, M modified, ?? untracked.

Was this page helpful?