Working Tree, Staging Area, Commits, and Branches
Why this matters
The working tree is your current files, the index/staging area selects the next snapshot, and commits form history. This lesson is intentionally framework-light. You are building a mental model that will be reused when Next.js, NestJS, Prisma, TanStack Query, and deployment tooling add more vocabulary. The goal is not to memorize definitions. The goal is to predict what the computer will do and know where to look when reality differs from that prediction.
Mental model
• The working tree is your current files, the index/staging area selects the next snapshot, and commits form history.
• A branch is a movable name pointing to a commit; switching branches changes which snapshot/history you are building on.
• git status is the first diagnostic command before destructive actions.
• Small coherent commits make debugging/review/revert dramatically easier.
Step-by-step walkthrough
1. Write the concept in your own words before using a tool. If your explanation depends on framework jargon, simplify it one level.
2. Create the smallest runnable example that demonstrates only this concept. Keep it outside the main TaskFlow repository if experimentation could create noise.
3. Predict the result before running the command or clicking the UI. Prediction makes the output evidence instead of entertainment.
4. Run it and capture what actually happened: terminal output, browser state, request details, or file changes.
5. Change one assumption and repeat. Try an invalid input, wrong path, missing field, reordered data, or other safe failure relevant to the topic.
6. Explain the difference between the successful and failing runs. That explanation is the transferable skill.
TaskFlow connection
Later in the course, git and github foundations stops being an isolated topic and becomes infrastructure for real features. When you encounter working tree, staging area, commits, and branches again, ask which layer owns it, what its inputs are, what output proves success, and what failure evidence is available. That prevents you from copying framework snippets without understanding the underlying browser, runtime, operating-system, or language behavior.
Guided exercise
Create a tiny example from scratch without copying the final code from a tutorial. Keep the example under about 30–50 lines where possible. After it works, deliberately break one assumption. Write the exact symptom and the smallest fix. Then delete the experiment or commit it in a dedicated practice folder so it does not pollute production project structure.
Check your understanding
• Can you describe the concept without naming a framework?
• Can you point to the exact input and output?
• Can you name one common incorrect assumption?
• Can you reproduce the idea in a tiny example?
• Can you diagnose one intentional failure using evidence rather than guesses?
Instructor note
Do not rush because the syntax looks easy. Most difficult full-stack bugs are not caused by forgetting syntax; they come from an incorrect model of ownership, execution environment, identity, time, or data flow. The foundation track exists so later lessons can move quickly without becoming mysterious.