Git Status: Understand File States
What does status tell you?
git status reports the current branch and changes that are staged, unstaged or untracked. It does not record a commit. Think of it as a checklist of what is waiting to be saved. In this chapter use a new disposable repository; never experiment inside an important project. The setup below assumes Bash or Git Bash and Git 2.47.3 (commands also exist in many older releases). Choose a fresh directory outside any existing repository and stop if any setup command fails.
mkdir bytemind-stage-lab && cd bytemind-stage-labgit init -b maingit config --local user.name "ByteMind Learner"git config --local user.email learner@example.invalidgit status --shortThe final command produces no output in the empty repository. There is no commit yet. The identity is synthetic and local to this lab.
Recognize an untracked file
Create a notes file. A file that Git has not added to the index and that is not ignored is normally shown as untracked. Saving in an editor is not the same as saving in Git history.
Expected: ?? notes.txt. The two question marks mean the file is untracked.
Read the two status columns
For ordinary tracked files the first column compares the index (the proposed next snapshot) with HEAD (the current commit); the second compares the working file with the index. A means added to the index, M means modified only in the working tree, M means modified in the index, and MM means both differ. D denotes deletion; ?? is a special untracked code. A clean status means no reported changes, not that every file is backed up: ignored files can be absent from the report. Conflicts use special codes and are taught later.
Practice: predict the status after creating a second new file, then check it. For the connected lab, keep only notes.txt; use a separate fresh lab for this optional task.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Git Status: Understand File States — knowledge check
Apply the lesson to common beginner repository states.
A new notes.txt is not ignored and has never been staged. What does ?? mean?
What does git status do by itself?
For an ordinary tracked file, what does a leading space followed by M mean?
What does MM mean in ordinary short status?
Why is a clean status not proof of a complete backup?