git status
Show the state of your working files and staging area
The 'git status' command shows which files you changed, which changes are staged for the next commit, and which files Git does not track yet. It never changes anything, so it is safe to run at any time — run it before every git add and git commit. It also tells you which branch you are on and, with a remote, how far you are ahead or behind.
Synopsis
git status [<options>] [--] [<pathspec>...]Options
Choosing the Right Option
Short format codes
The two columns of git status -s
| Command | Meaning |
|---|---|
?? file | Untracked: Git does not know the file |
M file | Modified, not staged |
M file | Modified and staged |
MM file | Staged, then modified again |
A file | New file, staged |
D file | Deleted, not staged |
Examples
Full status
git statusLists staged changes, unstaged changes and untracked files, with hints.
Short format
git status -sOne line per file with a two-letter code.
Short with branch
git status -sbShort format plus the branch and its ahead/behind counts.
Workflow Examples
git statusSee what changed
git add app.jsStage the file you want
git statusCheck it is under "Changes to be committed"
git commit -m "Add to cart"Commit
Troubleshooting
A file does not appear in git status
Cause: It is listed in .gitignore, or it has not changed
Check with git check-ignore -v <file>; unchanged tracked files are not listed
git status is slow in a big repository
Cause: Git scans every file of the working tree
Limit it to a folder: git status src/
Tips & Pitfalls
Best Practices
- ✓Run git status before git add and before git commit.
- ✓Read the hints: git status prints the command to undo each state.
- ✓Use git status -sb for a compact view that still shows the branch.
Common Mistakes
- ✗Committing without checking git status first, and recording files you did not mean to.
- ✗Thinking an untracked file will be committed — it has to be added first.
- ✗Reading " M" and "M " as the same thing: the column says whether the change is staged.
FAQ
No. It only reads your files, the staging area and the last commit.
Your files, the staging area and the last commit are identical: there is nothing to commit.
You staged it, then edited it again. The staged version is what the next commit will record.