git status Command Guide
Check the state of your working directory and staging area
Dai Aoki
CEO at init, Inc. / CTO at US & JP startups / Creator of WebTerm
Quick Reference
Basic
git statusShow working tree statusgit status -sShort format outputgit status -bShow branch infoOutput Format
--shortShort format--longLong format (default)--porcelainMachine-readableFiltering
-unoHide untracked files-uShow untracked files--ignoredShow ignored filesDownloadable Image Preview
Basic Usage
The git status command displays the state of the working directory and the staging area. It shows which changes have been staged, which haven't, and which files aren't being tracked by Git.
# Basic status check
git status
# Short format output
git status -s
# Show branch and tracking info
git status -sbUnderstanding the Output
The output of git status shows several categories of files:
$ git status
On branch main
Your branch is up to date with 'origin/main'.
Changes to be committed:
(use "git restore --staged <file>..." to unstage)
modified: src/app.js
new file: src/utils.js
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: README.md
Untracked files:
(use "git add <file>..." to include in what will be committed)
config.jsonFile Status Categories
- Changes to be committed: Files in the staging area, ready for commit
- Changes not staged: Modified tracked files not yet staged
- Untracked files: New files Git doesn't track yet
Common Options
| Option | Description |
|---|---|
| -s, --short | Give output in short format |
| -b, --branch | Show branch and tracking info in short format |
| --porcelain | Machine-readable output format |
| -u, --untracked-files | Show untracked files (all, normal, no) |
| --ignored | Show ignored files |
| -v, --verbose | Show staged changes in diff format |
Short Format
The short format uses two-letter status codes:
$ git status -s
M src/app.js # Modified and staged
M README.md # Modified but not staged
A src/utils.js # Added (new file staged)
?? config.json # Untracked file
MM src/index.js # Modified, staged, then modified again| Code | Meaning |
|---|---|
| ?? | Untracked file |
| A | Added (new file) |
| M | Modified |
| D | Deleted |
| R | Renamed |
| !! | Ignored file (with --ignored) |
Practical Examples
# Check status before committing
git status
# Quick status check with branch info
git status -sb
# Check status of specific path
git status src/
# Show ignored files
git status --ignored
# Use in scripts (stable output)
git status --porcelain
# Verbose output with diff
git status -v
# Hide untracked files
git status -unoFrequently Asked Questions
What does "Changes not staged for commit" mean?
This means you have modified files that are tracked by Git, but you haven't added them to the staging area yet. Use "git add <file>" to stage them for the next commit.
What does "Untracked files" mean?
Untracked files are new files that Git doesn't know about yet. They haven't been added to the repository. Use "git add <file>" to start tracking them.
How do I see only staged changes?
Use "git diff --staged" or "git diff --cached" to see only the changes that have been staged for commit.
What is the difference between -s and --porcelain?
Both provide short output, but --porcelain guarantees stable output format across Git versions, making it ideal for scripts. -s is for human readability.
How do I check status of a specific file?
Run "git status <filename>" to see the status of a specific file only.
Summary
git status is one of the most frequently used Git commands. It helps you understand what's happening in your repository before making commits.
Quick Reference
git status- Full status outputgit status -s- Short formatgit status -sb- Short format with branchgit status -uno- Hide untracked filesgit status --porcelain- Script-friendly output
Official Documentation
For authoritative information, refer to the official documentation: