Repository State Diagnostics
What This Practice Page Is For
This page checks whether you can actually read Git state instead of reacting to command output mechanically.
You should be able to:
- distinguish working tree, index, and last commit
- choose between
status,diff,diff --staged,log, andshow - explain repository state in one sentence before acting
Before You Start
Do the first pass from memory in a throwaway repository.
Use this rule:
- first inspect
- then explain
- only then change state
Retrieval Round
Answer from memory:
- What is the difference between working tree, index, and repository?
- What does
git diffcompare? - What does
git diff --stagedcompare? - What does
HEADusually point to? - What does
git show HEADtell you thatgit statusdoes not?
If more than two answers are weak, revisit Cluster 1 before continuing.
Compare and Distinguish
Pair 1
Compare:
git statusgit diff
Explain what each command is for and why one is not a substitute for the other.
Pair 2
Compare:
- modified
- staged
- committed
Give one sentence for each state.
Pair 3
Compare:
git log --onelinegit show HEAD
Explain when you would prefer each one.
Common Mistake Check
For each mistake:
- say what is wrong
- write the safer move
- explain why
Mistakes:
- Committing without checking what is staged.
- Using
git pullbefore reading current local state. - Assuming a clean
git diffmeans nothing is staged. - Thinking
origin/mainupdates by itself without communication.
Mini Application
Create this scenario:
- one modified tracked file
- one staged tracked file
- one untracked file
Then run:
git status
git diff
git diff --staged
git log --oneline --decorate --graph --all -3
Write a four-line diagnosis of the repository.
Evidence Check
You are done only when you can:
- identify what is modified, staged, and untracked
- choose the right inspection command for each question
- explain why a command is safe before you use it
If You Got Stuck
Revisit: