If you only memorize one Git command besides git add, make it git status. It answers the question: "What's going on in my repo right now?"

Run it anytime you're confused. Seriously — anytime.

Fresh Repository

Right after git init, with one untracked index.html:

git status

You'll see something like:

On branch main

No commits yet

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

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

Let's read this output:

  • On branch main — You're on the default branch called main. Branches come later; for now, all your work lives here.
  • No commits yet — The repository has no saved snapshots.
  • Untracked files — Git sees index.html but isn't tracking it.
  • nothing added to commit — Nothing is staged yet.

After Editing a Tracked File

Once you've added and committed a file, edits show up differently. Suppose you've committed index.html and then change the heading:

<h1>Hello, Git! Version 2</h1>

Run git status again:

On branch main
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:   index.html

no changes added to commit (use "git add" and/or "git commit -a")

Now Git says modified instead of untracked. The file is tracked, but your latest edits aren't staged yet.

After Staging

If you run git add index.html and then git status:

On branch main
Changes to be committed:
  (use "git restore --staged <file>..." to unstage)
        modified:   index.html

Changes to be committed means the file is staged and ready for git commit.

Clean Working Tree

After you commit, git status shows:

On branch main
nothing to commit, working tree clean

That's the calm state — no pending changes. Time to write more code.

Short Status

For a compact view:

git status -s

Output uses two columns:

?? index.html      # untracked
 M index.html      # modified, not staged
M  index.html      # staged
MM index.html      # staged AND modified again since staging

The left column is the staging area; the right column is the working directory. You won't need -s every day, but it's handy once you're comfortable.

Make It a Habit

Good workflow rhythm:

  1. Make changes in your editor.
  2. Run git status.
  3. Stage what you want with git add.
  4. Run git status again to confirm.
  5. Commit.

Step 2 and 4 prevent surprises. You'll always know exactly what Git thinks you're about to save.