Lesson 8 of 6815 min read

git status: Understanding Tracked, Untracked, Modified, and Staged Files

Learn to read git status output precisely — the command you'll run more than any other to understand exactly what Git currently sees in your project.

Author: CodersNexus

git status: Understanding Tracked, Untracked, Modified, and Staged Files

If there's one command you'll type more than any other while learning Git, it's `git status`. It's your project's dashboard — a snapshot showing exactly what Git currently sees: which files are brand new and unknown to Git, which have been changed since the last commit, and which have already been staged and are ready to be committed. Learning to read its output fluently is one of the fastest ways to build genuine confidence with Git.

Learning Objectives

  • Run git status and interpret its default, verbose output.
  • Distinguish between untracked, modified, and staged files.
  • Use the short-format flag (-s) for a more compact status view.
  • Connect git status directly to the three-states model from Lesson 6.

Key Terms to Know Before Learning git status

  • Untracked file: A file that exists in the working directory but that Git has never been told to track (i.e., it has never been added).
  • Tracked file: A file that Git is actively monitoring for changes, because it has been added and/or committed at least once before.
  • Modified (unstaged): A tracked file whose content has changed in the working directory since it was last staged or committed.
  • Staged: A file whose current changes have been added to the staging area and are marked ready for the next commit.
  • Clean working tree: The state git status reports when there are no untracked, modified, or staged changes — everything matches the last commit.

How git status Actually Works

`git status` reports the state of every file in your project relative to the three states covered in Lesson 6. Running it in a freshly initialized repository with some new files produces output roughly like this:

```
On branch main

No commits yet

Untracked files:
(use "git add <file>..." to include in what will be committed)
index.html
style.css

nothing added to commit but untracked files present (use "git add" to track)
```

This tells you three things clearly: which branch you're on (`main`), that no commits exist yet, and that `index.html` and `style.css` are untracked — meaning Git sees them sitting in the working directory but has never been instructed to track their changes.

Once you run `git add index.html`, running `git status` again shows a different section:

```
Changes to be committed:
(use "git restore --staged <file>..." to unstage)
new file: index.html

Untracked files:
style.css
```

Now `index.html` appears under 'Changes to be committed' — it's staged and ready for the next commit — while `style.css` remains untracked, since it hasn't been added yet.

After your first commit, if you go back and edit `index.html` again without staging the new edit, `git status` will show a third category:

```
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
modified: index.html
```

This is the 'modified' state — Git recognizes this file was previously committed, but its current content in the working directory now differs from what was last staged/committed, and that difference hasn't yet been re-staged.

When there is nothing to report — every tracked file matches the last commit and there are no untracked files — `git status` reports a **clean working tree**:

```
On branch main
nothing to commit, working tree clean
```

For a faster, more compact view (especially useful once you're comfortable with the concepts), `git status -s` (or `--short`) condenses this into a compact two-column format, using symbols like `??` for untracked, `A` for added/staged, and `M` for modified, with the left column representing the staging area and the right column representing the working directory.

git status: Visual Walkthrough

Draw a decision-flow diagram: start with a box 'Run git status'. It branches into four outcome boxes: 'Untracked files: (new files Git has never seen)', 'Changes to be committed: (staged, ready for next commit)', 'Changes not staged for commit: (modified since last stage/commit)', and 'nothing to commit, working tree clean: (everything matches last commit)'. Use color coding conceptually: untracked and unstaged changes as 'red' (attention needed), staged changes as 'green' (ready to commit), clean tree as neutral.

git status: Quick Reference Table

Status CategoryMeaningShort Format SymbolHow to Change It
UntrackedGit has never tracked this file??git add <file> to start tracking
Changes to be committedStaged and ready for next commitA / M (left column)git commit to save; git restore --staged to undo
Changes not staged for commitModified since last stage/commitM (right column)git add <file> to stage the new changes
Clean working treeNothing to commit; everything matches last commit(no output)N/A — this is the goal state

git status: Command Syntax and Examples

# Full, verbose status output
git status

# Example after creating two new files:
# Untracked files:
#   index.html
#   style.css

git add index.html
git status
# Changes to be committed:
#   new file:   index.html
# Untracked files:
#   style.css

# Compact short-format view
git status -s
# A  index.html      <- staged (Added)
# ?? style.css       <- untracked

Breaking Down the git status Example

The verbose `git status` output is descriptive and beginner-friendly, explicitly telling you which commands to run next (e.g., 'use "git add <file>..."'). After staging `index.html`, it moves from the 'Untracked files' section into 'Changes to be committed', reflecting its new state in the staging area. The short-format `-s` view condenses this same information: `A` in the left column means the file is staged as newly Added, while `??` means the file is completely untracked — this compact view becomes very efficient once you're fluent in reading it.

How git status Is Used on Real Engineering Teams

  • Experienced developers run git status reflexively — often before and after nearly every other Git command — to confirm exactly what state their repository is in before acting.
  • Many terminal prompt customization tools (like Oh My Zsh or Starship) display a live summary of git status directly in the command prompt, so developers see staged/modified indicators without even typing the command.
  • Code review culture strongly encourages running git status right before committing, to catch accidentally staged files (like debug logs or local config) before they're permanently recorded in history.
  • CI/CD scripts sometimes run git status --porcelain (a stable, script-friendly short format) to programmatically check whether a build produced any uncommitted changes.

git status Interview Questions and Answers

Q1. What is the difference between an untracked file and a modified file in Git?

An untracked file is one Git has never been told to track — it has never been staged or committed. A modified file is one that Git already tracks (it has been committed before) but whose current content in the working directory differs from what was last staged or committed.

Q2. What does 'Changes to be committed' mean in git status output?

It means those specific changes have been staged using git add and are marked ready to be included in the next git commit. They exist in the staging area but have not yet been permanently saved to the repository's history.

Q3. What does a 'clean working tree' message from git status indicate?

It means there are no untracked files, no unstaged modifications, and nothing currently staged — every tracked file in the working directory exactly matches the content of the most recent commit.

git status Quiz: Test Your Understanding

1. What does git status report about a brand new file that has never been added?

  1. Modified
  2. Staged
  3. Untracked
  4. Committed

Answer: C. Untracked

Explanation: A file Git has never been instructed to track via git add is reported as untracked, since Git has no record of it in the staging area or repository history.

2. In the short-format output of git status -s, what does '??' indicate?

  1. The file is staged
  2. The file is untracked
  3. The file has a merge conflict
  4. The file was deleted

Answer: B. The file is untracked

Explanation: The '??' symbol in git status -s output specifically marks files that Git is not currently tracking at all.

3. After running git add on a modified file, where will it appear in git status output?

  1. Untracked files
  2. Changes to be committed
  3. Changes not staged for commit
  4. It disappears from the output entirely

Answer: B. Changes to be committed

Explanation: Once a change is staged with git add, git status moves it into the 'Changes to be committed' section, reflecting that it's now ready for the next commit.

git status: Common Mistakes Beginners Make

  • Ignoring the 'Untracked files' section and assuming those files are already being version controlled — they are not, until explicitly staged.
  • Confusing 'Changes to be committed' (staged) with actually being committed — staged changes are still lost if not eventually committed and if the staging area is manipulated carelessly.
  • Not running git status often enough, leading to accidentally committing unintended files or missing important unstaged changes.
  • Overlooking that a single file can appear in both the staged and unstaged sections simultaneously if it was staged, then edited again.

git status: Exam-Ready Quick Notes

  • Four key states reported by git status: untracked, staged ('Changes to be committed'), unstaged modified ('Changes not staged for commit'), and clean.
  • Short format symbols: ?? untracked, A staged addition, M modified (left column = staged, right column = working directory).
  • git status is read-only — it never changes any files or Git state, making it completely safe to run at any time.

git status: Key Takeaways

  • git status is the primary window into Git's three-state model — always run it when uncertain about your repository's current state.
  • Learning to distinguish untracked, modified, and staged categories removes most beginner confusion about what Git is 'doing'.
  • The short-format (-s) view is a faster alternative once you're comfortable interpreting the verbose default output.

Frequently Asked Questions About git status

Q1. What is git status used for?

git status shows the current state of your project relative to Git's tracking — which files are untracked, which have been modified but not staged, which are staged and ready to commit, and whether your working tree is completely clean.

Q2. What does 'untracked' mean in git status?

It means the file exists in your project folder, but Git has never been told to track it via git add — Git has no record of its history or changes at all yet.

Q3. What's the difference between 'Changes to be committed' and 'Changes not staged for commit'?

'Changes to be committed' means those changes have been staged with git add and will be included in your next commit. 'Changes not staged for commit' means the file has been modified since it was last staged or committed, but that new change hasn't been added to the staging area yet.

Q4. What does 'nothing to commit, working tree clean' mean?

It means every tracked file in your working directory exactly matches your most recent commit, and there are no untracked files present — there's simply nothing new to save right now.

Q5. Is it safe to run git status at any time?

Yes, completely. git status is a purely read-only, informational command — it never modifies your files, staging area, or commit history in any way, so you can run it as often as you like.

Summary

`git status` is Git's most frequently used command, reporting exactly which files are untracked (never added to Git), staged (added and ready for the next commit, shown as 'Changes to be committed'), modified but unstaged (changed since the last stage or commit, shown as 'Changes not staged for commit'), or unchanged (a 'clean working tree'). It's a completely read-only, safe command that directly reflects the three-states model of the working directory, staging area, and repository. Fluency in reading git status output — including its compact short format (-s) — is foundational to working confidently and safely with Git.

Frequently Asked Questions

git status shows the current state of your project relative to Git's tracking — which files are untracked, which have been modified but not staged, which are staged and ready to commit, and whether your working tree is completely clean.

It means the file exists in your project folder, but Git has never been told to track it via git add — Git has no record of its history or changes at all yet.

'Changes to be committed' means those changes have been staged with git add and will be included in your next commit. 'Changes not staged for commit' means the file has been modified since it was last staged or committed, but that new change hasn't been added to the staging area yet.

It means every tracked file in your working directory exactly matches your most recent commit, and there are no untracked files present — there's simply nothing new to save right now.

Yes, completely. git status is a purely read-only, informational command — it never modifies your files, staging area, or commit history in any way, so you can run it as often as you like.