Skip to content

git status

Inspecting the state of your repository with git status — your Git dashboard.

What you'll learn

  • How to read the git status output
  • The three sections: staged, unstaged, and untracked
  • Using git status -s for a compact view
  • Why you should run git status constantly

Concept

What git status Does

git status is the most frequently used Git command. It tells you the current state of your repository: what has changed, what is staged, and what is untracked. Run it constantly — before and after every other command.

git status

Reading the Output

The output has three sections:

On branch main

Changes to be committed:        ← STAGED (will be in next commit)
  modified:   index.html

Changes not staged for commit:  ← UNSTAGED (modified but not added)
  modified:   style.css

Untracked files:                ← UNTRACKED (Git is not tracking these)
  new-file.js
  • Changes to be committed — files in the staging area. These will be included in your next git commit.
  • Changes not staged for commit — tracked files that have been modified but not yet git add-ed.
  • Untracked files — new files that Git has never seen. Use git add to start tracking them.

The Short Format

For a quick, compact view, use git status -s (or --short):

git status -s
M  index.html     ← M in first column = staged modification
 M style.css      ← M in second column = unstaged modification
?? new-file.js    ← ?? = untracked
A  added-file.js  ← A = staged new file
D  deleted-file.js ← D = staged deletion

The first column shows the staged state, the second shows the unstaged state. Once you can read this, you will prefer it over the long format.

Why git status Is Essential

git status prevents mistakes:

  • Before committing — make sure you are committing what you think you are
  • After cloning — confirm which branch you are on
  • Before branching — make sure your working tree is clean
  • After merging — check for conflicts

If git status says nothing to commit, working tree clean, it means there are no uncommitted changes — you are in a safe state to branch, pull, or push.

Useful Flags

git status                  # full output
git status -s               # short, compact output
git status --branch         # include branch tracking info
git status --ignored        # show ignored files too
git status -uno             # hide untracked files

Example

              # Make some changes to see different states
echo "new content" >> README.md       # modify a tracked file
echo "body { color: red; }" >> style.css  # modify another tracked file
echo "console.log('new');" > new-feature.js  # create a new file

# Full status output — three sections
git status

# Short status — compact one-line-per-file format
git status -s

# Stage one file and see how the status changes
git add README.md
git status -s
# README.md now shows 'M ' (staged) instead of ' M' (unstaged)

# Stage everything and check again
git add .
git status -s
# All files now show in the staged column

# Commit and verify clean tree
git commit -m "Add new feature and update styles"
git status
# "nothing to commit, working tree clean"

# See branch tracking information
git status -b
            

Create changes, then use git status and git status -s to see how files move between untracked, unstaged, and staged states. The short format is worth memorizing — it is the fastest way to check your repo.

Try it

  • Code Diff

    Compare versions — git status tells you what changed, diff shows how.

  • File Hash Checksum

    Git uses content hashes to detect changes — see hashing in action.

Common mistakes

The mistake

Not running git status and committing the wrong files

The fix

Always run git status before git commit to see exactly what will be committed. Use git status -s for a quick check. This prevents accidentally committing debug code or sensitive files.

The mistake

Ignoring untracked files that should be committed

The fix

Untracked files (marked with ??) are easy to miss. Run git status and look for the 'Untracked files' section. If a file should be in the repo, git add it; if not, add it to .gitignore.

Related Cheatsheets

Practice git status

1 exercise

Practice git status

Look up unfamiliar terms

A beginner-friendly glossary explains jargon in plain English — variables, functions, DOM, Promise, and more.

View glossary

Build real projects

Apply what you learned by building guided projects with starter code and solutions.

View projects

Decode error messages

Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.

View errors