Module 3: Git Fundamentals
Primary texts: Pro Git and Git from the Bottom Up
Selective support: GitHub-style pull request workflow only where it clarifies collaboration habits
This module turns Git from a list of commands into a usable model. You are not trying to memorize every command. You are trying to understand what Git is tracking, what state your work is in, and how to move safely between local work, shared history, and recovery.
Before You Start (Diagnostic Prerequisites Assessment)
Prerequisite Competency Verification
Time Limit: 20 minutes, closed-book
Format: Short diagnostic with immediate self-correction
Purpose: Verify that your Module 02 shell skills are strong enough to support command-line Git work
Git gets painful when shell basics are shaky. You should be able to navigate directories, inspect files, and read command output cleanly before you try to reason about branches, merges, and recovery.
Diagnostic Questions
Question 1: Tooling Baseline
What command tells you which files in the current directory are visible, including hidden entries such as .git?
a) pwd
b) ls -a
c) cat .git
d) touch .git
Correct Answer: (b)
Why This Matters: Git stores repository metadata in .git, so you need to be comfortable inspecting the filesystem around a repository.
Question 2: Path and Context
You are in ~/projects/app/src and need to move to the repository root ~/projects/app. Which command is correct?
a) cd /app
b) cd ../..
c) cd ..
d) cd ~/app
Correct Answer: (c)
Why This Matters: Git commands are often run from different directories inside a repository, so path awareness matters.
Question 3: Reading Output
Which statement best describes the difference between standard output and standard error?
a) They are two names for the same stream
b) Standard output carries normal program output; standard error carries warnings and failures
c) Standard error is only used by shell builtins
d) Standard output can be redirected, but standard error cannot
Correct Answer: (b)
Why This Matters: Git uses both streams, especially during merge conflicts, failed pulls, and recovery operations.
Question 4: Safe Inspection
You want to see what changed in a file before doing anything destructive. Which mindset is best?
a) Edit first and inspect later
b) Inspect current state before changing it
c) Re-clone the repository immediately
d) Delete the file and recover it later
Correct Answer: (b)
Why This Matters: Good Git workflow starts with reading state accurately before mutating history or the working tree.
Question 5: Reproducible Workflow
Why is command-line Git preferred as a baseline even if GUI tools exist?
a) GUI tools are forbidden on professional teams
b) Command-line Git integrates directly with shell workflow, remote machines, and automation
c) GUI tools cannot show diffs
d) Command-line Git uses different repositories than GUI tools
Correct Answer: (b)
Why This Matters: This module assumes Git is part of your everyday terminal workflow, not a separate visual tool you only open when confused.
Scoring and Progression Gates
Strong Foundation (80-100% correct):
- Status: Ready to proceed
- Evidence: You can navigate, inspect, and reason about terminal state without friction
- Action: Start Cluster 1 and build Git concepts on top of that shell fluency
Developing Foundation (60-79% correct):
- Status: Review required
- Evidence: You can work in the shell, but weak spots may turn Git mistakes into bigger mistakes
- Required Actions:
- Revisit Module 02 shell navigation, process, and stream concepts
- Repeat the shell workshop page from Module 02
- Retake the missed diagnostic questions from memory
Insufficient Foundation (<60% correct):
- Status: Stop and rebuild shell baseline
- Evidence: Git commands will feel arbitrary because terminal context is still unstable
- Required Actions:
- Rework Module 02 Cluster 1 before continuing
- Practice
cd,ls,cat, redirection, and command reading daily - Return only when terminal output no longer feels noisy or mysterious
Automatic Remediation Pathways
Questions 1-2 (Shell and Paths) - If Missed:
- Immediate Resource: Module 02: Shell Navigation and File Operations
- Practice Exercise: Navigate between three repository subdirectories and back to root without using the mouse
- Verification: Explain what
.gitis and where it lives
Questions 3-4 (Reading State Before Acting) - If Missed:
- Immediate Resource: Module 02: Command Composition, Redirection, and Pipes
- Practice Exercise: Redirect stdout and stderr from a command into separate files and inspect them
- Verification: Explain why safe tooling starts with inspection
Question 5 (Workflow Integration) - If Missed:
- Immediate Resource: Module 02: Workflow Integration, Remote Work, and Automation
- Practice Exercise: Write down one repeated development task that belongs in the shell, not in a GUI
- Verification: Explain how Git fits into the same workflow
What This Module Is For
Git is the version-control layer for almost everything you will build from this point onward. That includes homework, projects, pair work, portfolio artifacts, open source contributions, CI pipelines, and professional code review.
This module teaches four things that are easy to confuse if you learn Git only as command trivia:
- what Git stores
- what state your repository is currently in
- how to collaborate without corrupting shared history
- how to recover when you inevitably make mistakes
Concept Map
How To Use This Module
This module is organized into three clusters. Treat each cluster as a layer of capability.
Cluster 1: Git Foundations
| Order | Concept | Type | Focus |
|---|---|---|---|
| 1 | Git Mental Model: Snapshots, HEAD, and References | PRIMARY | What Git stores and why branches are cheap |
| 2 | The Staging Area and the Commit Cycle | SUPPORTING | Working tree, index, git add, and intentional commits |
| 3 | Reading History, Diffs, and Repository State | SUPPORTING | status, diff, log, and commit inspection |
Cluster mastery check: Can you explain what is different between the working tree, index, and last commit without guessing?
Cluster 2: Collaboration Mastery
| Order | Concept | Type | Focus |
|---|---|---|---|
| 4 | Branches, Merge, and Rebase | PRIMARY | Topic branches, integration choices, and branch pointers |
| 5 | Remotes, Fetch, Pull, and Push | SUPPORTING | Remote-tracking branches and synchronization |
| 6 | Pull Requests, Code Review, and Conflict Resolution | SUPPORTING | Shared work, review scope, and resolving conflicts cleanly |
Cluster mastery check: Can you move work between local and shared repositories without treating pull as a mystery button?
Cluster 3: Professional Practices
| Order | Concept | Type | Focus |
|---|---|---|---|
| 7 | Commit Discipline and Everyday Workflow | PRIMARY | Small commits, branch hygiene, and choosing a team workflow |
| 8 | Recovery with Reset, Stash, and Reflog | SUPPORTING | Safe undo, temporary shelving, and recovering lost references |
Cluster mastery check: Can you recover from a mistake without panic and explain why your recovery method is safe?
Practice Integration
| Order | Practice Path | Focus |
|---|---|---|
| 1 | Repository State Diagnostics | Reading status, diff, and the three-state model accurately |
| 2 | Branching and Integration Lab | Branching, merging, rebasing, and conflict practice |
| 3 | Collaboration and Review Lab | Remotes, review workflow, and integration discipline |
| 4 | Code Katas | Timed repetition until common Git operations feel automatic |
Learning Objectives
By the end of this module you should be able to:
- Explain Git as a snapshot-based system with commits, references, and a staging area.
- Use
status,diff,log, andshowto inspect repository state before acting. - Create coherent commits using the index instead of committing a whole messy working tree.
- Use topic branches, merges, and rebases deliberately rather than mechanically.
- Synchronize with remotes using
fetch,pull, andpushwhile understanding what each changes. - Participate in pull request style collaboration and resolve merge conflicts cleanly.
- Apply a simple professional workflow with small commits, readable history, and branch hygiene.
- Recover from common mistakes using
stash,reset, andreflogwithout losing work.
Outputs
- one local practice repository showing clean
init,add,commit, andlogusage - one branch exercise repository with at least one merge and one deliberate conflict resolution
- one remote-backed repository or local two-clone simulation showing
fetch,pull, andpush - one short workflow note explaining your merge vs rebase rule
- one commit message checklist for future projects
- one recovery log showing
stashandreflogdrills
Completion Standard
You have completed Module 3 when you can:
- explain what a commit, branch, HEAD, and index each represent
- inspect a repository and tell what is modified, staged, committed, ahead, or behind
- split unrelated changes into separate commits with intentional messages
- create, switch, merge, and delete topic branches without confusion
- explain the difference between
fetchandpullin plain language - resolve a basic merge conflict and describe why the final result is correct
- recover from a mistaken reset or shelve unfinished work without panic
Reading Policy
- The concept pages are the main path.
- You do not need to read the full books front-to-back to complete this module.
- Open the local source chunks only when a concept page says
Read This Only If Stuckor when you want a deeper model. - Prefer hands-on repository practice over passive reading. Git understanding hardens through inspection and repetition.
Source Integration
Git from the Bottom Up
Use this book for the parts of Git that are easy to misuse when you only memorize commands:
- repository, commit, branch, and HEAD as actual model elements
- why the index exists
- what
reset,stash, andreflogare really doing - why rebase changes history and when that matters
Pro Git
Use this book for the practical daily workflow:
- repository creation and file lifecycle
- status, diff, log, and history inspection
- branches, remotes, and tracking branches
- pull request flow, collaboration patterns, and conflict handling
Use Reference and Selective Reading when a concept still feels unstable after practice.
Rich Learning Pages
Worked Examples | Guided Labs | Case Studies | Mistake Clinic | Reading Guide | Capstone Thread