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
Syntax
git status [-s] [-b]
Parameters
| Parameter | Description |
|---|---|
-s |
Short format: XY status codes per file. |
-b |
Include the branch line in short format. |
Examples
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.
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.
Related
git add· Stage changes for the next commit: whole files, all changes, or selected hunks with -p.git diff· Show changes: working tree versus staging area, staged changes (--staged), or between commits and branches.- Staging and Committing · tutorial