git status
The `git status` command shows the current state of your working directory and staging area. It tells you which files are modified, staged, or untracked, and which branch you're on.
Running `git status` frequently is a good habit โ it helps you understand exactly what will be included in your next commit before you make it.
git status
git status -sReading the output
git status separates files into groups: 'Changes to be committed' (staged), 'Changes not staged for commit' (modified but not staged), and 'Untracked files' (new files Git doesn't know about yet).
A shorter view
Run `git status -s` for a compact, short-format summary using letters like M (modified), A (added), and ?? (untracked).
git statusOn branch main
Changes not staged for commit:
modified: app.js
Untracked files:
notes.txtShows a modified tracked file and a new untracked file.
git status -s M app.js
?? notes.txtThe short format uses single letters to summarize file states compactly.
Key points
- git status shows staged, modified, and untracked files.
- It also shows your current branch name.
- git status -s gives a compact summary.
- Running it often helps avoid committing the wrong changes.
