Skip to content

git status — Reading the Working Tree

git status is the command you will run more than any other. It answers the question “what is going on in my repository right now?” — and learning to read its output precisely is one of the most valuable Git skills you can develop.

Run git status in your git-practice folder. You will see one of several possible states depending on what you have done. Here is a full example with something in every section:

On branch main
Your branch is up to date with 'origin/main'.
Changes to be committed:
(use "git restore --staged <file>..." to unstage)
modified: pine-ridge.txt
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: summit-challenge.txt
Untracked files:
(use "git add <file>..." to include in what will be committed)
river-canyon.txt

This output has four sections. Each tells you something different.

On branch main
Your branch is up to date with 'origin/main'.
  • On branch main — which branch you are currently on. This changes when you switch branches in Module 03.
  • Your branch is up to date with 'origin/main' — appears when the repo is connected to GitHub. It tells you whether your local history is ahead of, behind, or in sync with the remote. You will see this in Module 05.

In a local-only repository, you will only see the branch line.

Section 2: Changes to be committed (staged)

Section titled “Section 2: Changes to be committed (staged)”
Changes to be committed:
modified: pine-ridge.txt

These files are in the staging area. They have been added with git add and will be included in the next commit. The status label tells you what kind of change it is:

LabelMeaning
new file:A previously untracked file being committed for the first time
modified:A tracked file with changes staged
deleted:A tracked file that has been deleted and the deletion is staged
renamed:A file that has been moved or renamed

Section 3: Changes not staged for commit (unstaged modifications)

Section titled “Section 3: Changes not staged for commit (unstaged modifications)”
Changes not staged for commit:
modified: summit-challenge.txt

These files are tracked by Git and have been modified, but the changes have not been staged yet. Running git add summit-challenge.txt would move this file up to the “Changes to be committed” section.

A file can appear in both sections simultaneously — if you stage a file and then make additional edits, the staged version and the newer working-tree version are different. Git tracks both separately.

Untracked files:
river-canyon.txt

These files exist in your working tree but Git has never been told to track them. They will not be committed until you stage them with git add.

A file stays untracked forever until you explicitly add it. This is useful: you can keep files in your project folder that you never want to commit — logs, editor files, generated output — by simply never staging them. In Module 07 you will learn to use .gitignore to prevent untracked files from cluttering this section.

When there is nothing to report, you see:

On branch main
nothing to commit, working tree clean

This is the ideal state between work sessions. Every change has been committed, and the working tree perfectly matches the latest commit.

The -s flag gives a compact summary:

Terminal window
git status -s
M pine-ridge.txt
M summit-challenge.txt
?? river-canyon.txt

Each line is two columns:

  • The left column shows the staging area status (staged changes)
  • The right column shows the working tree status (unstaged changes)
  • ?? means untracked

The short format is useful when you have many files and want a quick scan. The long format (default) is better when you are learning or need to understand exactly what is happening.

  1. In your git-practice folder, modify pine-ridge.txt by adding a line. Create a new file river-canyon.txt with any content.

  2. Stage pine-ridge.txt:

Terminal window
git add pine-ridge.txt
  1. Run git status and identify all three sections: staged, unstaged (if you modify something further), and untracked.

  2. Edit pine-ridge.txt again after staging it. Run git status. Observe that it now appears in two sections — the staged version is what you staged, and the unstaged modification is what you added afterward.

  3. Run git status -s and match each line to the full output.

  • git status has four sections: branch info, staged changes, unstaged modifications, and untracked files.
  • Staged files are in the staging area and will be included in the next commit.
  • Unstaged files are tracked but have changes not yet added to the staging area.
  • Untracked files are unknown to Git until you run git add.
  • A file can appear in both staged and unstaged sections if you modify it after staging.
  • git status -s gives a compact two-column summary.
  • “Working tree clean” means everything is committed.

Next: git diff — seeing the exact line-by-line content of what changed, both in your working tree and in the staging area.