Git is easier when you separate what is in the working tree, what is staged and what has been shared. These cards are a recovery-friendly reference.
Work through the path
Open a card when you need it. Marking a lesson complete is optional and stays only in this browser.
1Make commits tell one story
A focused commit is easier to review, revert and move between branches than a mixed change.
A useful commit message answers what changed and why. The diff should be small enough that a reviewer can understand the behavior without reconstructing your day.
Before sharing, make the branch history useful to the next person and check the staged diff.
Try it
Run git diff before staging, then git diff --staged after staging.
git add src/Orders/Validation.cs git commit -m "Validate order lines before submission" git add tests/Orders/ValidationTests.cs git commit -m "Cover empty and duplicate order lines"
2Choose rebase or merge by collaboration policy
Both integrate history; the important rule is whether you are rewriting commits other people already use.
Rebase replays local commits on a new base and is useful before sharing. It changes commit identities.
Merge preserves existing history and is safer for commits already shared. Define the team policy instead of debating every pull request.
Try it
Practice rebase --abort in a throwaway repository before using it on a real branch.
git fetch origin git rebase origin/main # resolve conflicts, then: git add path/to/resolved-file git rebase --continue git push --force-with-lease
3Use revert for shared history and reset for local cleanup
Revert creates a new commit that undoes shared work; reset moves local branch pointers and can discard work.
If a bad commit is already on the shared branch, git revert records the undo and keeps the history visible. Use reset while cleaning a private branch.
Check the working tree before choosing --hard. Recovery is easier when you understand reflog and have backups.
Try it
Create a throwaway repository, commit a file, then compare revert with resetting before the commit.
git log --oneline -5 git revert <commit-sha> git push origin main
4Find a regression with bisect
Git bisect uses a known-good and known-bad commit to narrow a regression with logarithmic search.
You provide a repeatable test or manual check. Git checks out a midpoint; you mark it good or bad until the first bad commit is identified.
The method is only as reliable as the test. Keep the environment deterministic enough that the same commit gets the same answer.
Try it
Use bisect on a small repository with one intentionally broken commit.
git bisect start git bisect bad HEAD git bisect good v1.4.0 # run the regression check git bisect good # or: git bisect bad git bisect reset
No lesson matches that phrase.
Related tools
Turn the concept into a working example with the browser-based tools.