Skip to content

Commit 3fc2f55

Browse files
authored
Rebuild Git & GitHub course as an executable self-study course
Ship real module challenges, self-contained Actions practice, cross-platform quality gates, repository hygiene checks, Git behavior smoke tests, safer history-rewrite guidance, contribution rules, and licensing.
1 parent 151d39d commit 3fc2f55

26 files changed

Lines changed: 700 additions & 22 deletions

File tree

‎.github/workflows/quality.yml‎

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Course quality gates
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
permissions:
8+
contents: read
9+
10+
concurrency:
11+
group: course-quality-${{ github.workflow }}-${{ github.ref }}
12+
cancel-in-progress: true
13+
14+
jobs:
15+
validate:
16+
name: Validate ${{ matrix.os }} / Python ${{ matrix.python }}
17+
runs-on: ${{ matrix.os }}
18+
strategy:
19+
fail-fast: false
20+
matrix:
21+
os: [ubuntu-latest, windows-latest]
22+
python: ["3.12", "3.14"]
23+
24+
steps:
25+
- name: Check out repository
26+
uses: actions/checkout@v7
27+
28+
- name: Set up Python
29+
uses: actions/setup-python@v7
30+
with:
31+
python-version: ${{ matrix.python }}
32+
33+
- name: Validate course structure and links
34+
run: python scripts/validate_repo.py
35+
36+
- name: Compile validator
37+
run: python -m py_compile scripts/validate_repo.py
38+
39+
- name: Verify controlled CI demo
40+
working-directory: examples/actions/demo
41+
run: python -m unittest discover -s tests -v
42+
43+
- name: Verify Git conflict and reflog behavior
44+
run: python scripts/smoke_git_behaviors.py

‎CONTRIBUTING.md‎

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Contributing
2+
3+
Thanks for helping improve this course.
4+
5+
This repository is a textbook and reference implementation. Learner practice belongs in a separate disposable `git-github-lab` repository unless a contribution specifically improves the curriculum itself.
6+
7+
## Before opening a change
8+
9+
1. Read `SAFETY.md` if the change teaches recovery, reset, rebase, force operations, or history rewriting.
10+
2. Keep the course beginner-accessible. Prefer a precise mental model and a small reproducible exercise over adding more commands.
11+
3. Do not add claims of mastery that the learner cannot demonstrate.
12+
4. Do not add secrets, personal tokens, real credentials, or private repository data.
13+
5. Keep external resources supplementary; the core lesson must remain understandable without hunting through tutorials.
14+
15+
## Required local check
16+
17+
Run:
18+
19+
```bash
20+
python scripts/validate_repo.py
21+
```
22+
23+
The same validator runs on both Linux and Windows in GitHub Actions.
24+
25+
## Pull request standard
26+
27+
A useful pull request should explain:
28+
29+
- what learner problem it solves
30+
- what behavior or understanding changes
31+
- how the change was tested
32+
- any safety implications
33+
34+
For changes that add or modify a Git command exercise, include the expected observable repository state before and after the exercise.
35+
36+
## Course design rule
37+
38+
The learning loop is:
39+
40+
> **LEARN → PREDICT → DO → INSPECT → BREAK/RECOVER → EXPLAIN → PROVE**
41+
42+
Not every lesson needs every stage as a heading, but major capabilities should eventually require evidence rather than passive reading.

‎LICENSE‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2026 Adham Mahmood
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

‎Module_0_Setup/Exercises/.gitkeep‎

Whitespace-only changes.

‎Module_0_Setup/Exercises/README.md‎

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Module 0 Exercises — Setup and Mental Model
2+
3+
Use your disposable `git-github-lab` repository. Do not perform these exercises in the course repository.
4+
5+
## Challenge 1 — Prove your environment
6+
7+
Without copying commands from the guide, prove that:
8+
9+
- Git is installed and callable from your terminal
10+
- your Git identity is configured intentionally
11+
- you know which directory you are currently in
12+
- you can distinguish a normal folder from a Git repository
13+
14+
**Evidence:** record the commands you chose and explain what each output proved.
15+
16+
## Challenge 2 — Repository boundary
17+
18+
Create one normal folder and one Git repository. Put a file in each. Predict what `git status` will do in both locations, then test your prediction.
19+
20+
**Pass when:** you can explain what `.git` represents and why Git commands care about repository boundaries.
21+
22+
## Challenge 3 — Rebuild from memory
23+
24+
Delete only your disposable practice repository, recreate it from scratch, initialize Git, create a first file, inspect state, make the first commit, and show the history.
25+
26+
**Do not advance** if you need a command-by-command recipe to complete this challenge.

‎Module_1_Daily_Core/Exercises/.gitkeep‎

Whitespace-only changes.
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Module 1 Exercises — Daily Core
2+
3+
Work only in your disposable student lab.
4+
5+
## Challenge 1 — Three states of one file
6+
7+
Create a file, stage it, then modify it again before committing.
8+
9+
Before running any corrective command, predict what each of these will show:
10+
11+
```bash
12+
git status
13+
git diff
14+
git diff --staged
15+
```
16+
17+
Explain why the same file can appear in both staged and unstaged state.
18+
19+
## Challenge 2 — Selective commit
20+
21+
Create changes in at least three files. Make one focused commit that intentionally includes only part of the work.
22+
23+
**Evidence:** show the staged diff before the commit and explain why the omitted changes did not belong in it.
24+
25+
## Challenge 3 — Ignore-rule trap
26+
27+
Track a harmless fake configuration file, then add its pattern to `.gitignore`.
28+
29+
Predict whether Git stops tracking it. Test the prediction and explain why `.gitignore` is not a secret-removal mechanism.
30+
31+
## Boss check — Inspect before acting
32+
33+
Have another person or future-you make several mixed changes in the lab. Without immediately staging anything, determine:
34+
35+
- what changed
36+
- what is staged
37+
- what is not staged
38+
- what is untracked
39+
- what belongs in the next commit
40+
41+
**Pass when:** your first instinct is inspection, not `git add .`.

‎Module_2_Branching/Exercises/.gitkeep‎

Whitespace-only changes.
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Module 2 Exercises — Branching
2+
3+
Use the disposable student lab.
4+
5+
## Challenge 1 — Predict branch movement
6+
7+
Create two commits on `main`, create a feature branch, add two more commits there, and draw the commit graph you expect before inspecting it.
8+
9+
Then run:
10+
11+
```bash
12+
git log --oneline --graph --decorate --all
13+
```
14+
15+
Explain what the branch names point to.
16+
17+
## Challenge 2 — Fast-forward vs merge commit
18+
19+
Produce one merge that can fast-forward and one merge where both branches have diverged.
20+
21+
Before each merge, predict the resulting graph.
22+
23+
**Pass when:** you can explain why the outcomes differ without describing branches as folders or copies.
24+
25+
## Challenge 3 — Branch cleanup
26+
27+
Merge a finished feature, verify the work is reachable from `main`, then delete the local feature branch.
28+
29+
Explain why deleting the branch name does not delete commits that remain reachable from `main`.
30+
31+
## Boss check — Unknown graph
32+
33+
Create a small history with at least three branches and six commits. Leave it for a while, return without notes, inspect it, and explain which work is merged and which work remains isolated before running a merge command.

‎Module_3_Remotes/Exercises/.gitkeep‎

Whitespace-only changes.

0 commit comments

Comments
 (0)