Git
gitgitGuideBeginner
git status — Checking Working Tree State
Mastering git status: tracked vs untracked files, staged vs unstaged modifications, short format (-s), and branch sync status.
Verified: 2026-09-30
Platforms:
all
#git#status#working-tree#staging
git status — Checking Working Tree State
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.
1. Reading Standard Output
git statusExample output:
On branch main
Your branch is up to date with 'origin/main'.
Changes to be committed:
(use "git restore --staged <file>..." to unstage)
new file: content/docs/git/git-status.md
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: package.json
Untracked files:
(use "git add <file>..." to include in what will be committed)
scratch-notes.txtKey Sections:
- Changes to be committed (Staged): In the index, ready to become part of the next
git commit. - Changes not staged for commit (Unstaged): Tracked files with local modifications not yet added to the index.
- Untracked files: New files created on disk that Git is not yet tracking.
2. Short / Compact Status (-s or -sb)
For a clean, concise overview of modified files:
git status -sOutput:
M package.json # Staged modification (Green M)
M app/layout.tsx # Unstaged modification (Red M)
MM src/index.ts # Modified both staged and unstaged
A new-file.ts # Added / Staged (Green A)
?? notes.txt # Untracked (Red ??)Related Topics
git clone — Cloning a Remote Repository
How to clone remote Git repositories: HTTPS vs SSH cloning, shallow clones (--depth 1), branch targeting (-b), and directory naming.
git add — Staging Working Tree Changes
How to stage changes in Git: git add ., staging specific files, interactive patch staging (git add -p), and unstaging files.