Checking Your Spacecraft Systems
Before any launch, astronauts run systems checks. In Git, git status is your diagnostic command—it tells you exactly what's happening in your repository.
The Status Command
git status
This command shows:
- Which branch you're on
- Which files have changed
- Which files are staged for commit
- Which files are untracked
- How your local branch compares to remote
Understanding the Output
When you run git status in a new repository with one file, you might see:
On branch main
No commits yet
Untracked files:
(use "git add ..." to include in what will be committed)
README.md
nothing added to commit but untracked files present (use "git add" to track)
Let's decode this:
- "On branch main": You're on the main timeline
- "No commits yet": No snapshots recorded
- "Untracked files": Git sees README.md but isn't tracking changes yet
File States in Git
Files can be in several states:
Untracked
New files Git doesn't know about yet. They exist but aren't in version control.
Unmodified
Files tracked by Git that haven't changed since the last commit.
Modified
Tracked files that have changed but aren't staged for commit.
Staged
Files marked for inclusion in the next commit.
Status After Adding Files
After running git add README.md:
On branch main
No commits yet
Changes to be committed:
(use "git rm --cached ..." to unstage)
new file: README.md
Now README.md is in the staging area, ready for your first commit.
Short Status
For a condensed view:
git status -s
Output looks like:
A README.md
M script.js
?? new-file.txt
Codes:
??: UntrackedA: Added (staged)M: ModifiedD: DeletedR: Renamed
Why Status is Essential
Run git status often. It's your mission control readout, showing exactly what's happening. Before committing, pushing, or pulling, check status first.
Pro Tip: Many developers run git status dozens of times per day. It's muscle memory. There's no such thing as checking status too often.
Status in Different Scenarios
Clean Working Directory
On branch main
nothing to commit, working tree clean
All changes are committed. Systems are green.
Modified Files
Changes not staged for commit:
modified: navigation.js
You've changed files but haven't staged them.
Files Ready to Commit
Changes to be committed:
new file: thrusters.py
modified: fuel-system.js
Files are staged and ready for commit.
Practice Exercise
- Run
git statusin your repository - Create a new file:
touch flight-log.txt - Run
git statusagain—see the difference? - Edit README.md
- Run
git statusonce more
Watch how status changes as you modify your project.
Next: The Staging Area
Now you can check your system status. Next, we'll learn about the staging area—the launch pad where you prepare files for commit.