Git & GitHub ยท Chapter 9 of 42

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.

Syntax
git status
git status -s

Reading 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).

Example 1 (bash)
git status
Output
On branch main
Changes not staged for commit:
  modified:   app.js
Untracked files:
  notes.txt

Shows a modified tracked file and a new untracked file.

Example 2 (bash)
git status -s
Output
 M app.js
?? notes.txt

The 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.
๐Ÿ’ก Note: git status never changes anything โ€” it's completely safe to run at any time.

๐Ÿ“ Quick Quiz

1. What does git status show?

2. What does 'M' mean in git status -s output?

3. Does git status change any files?