Git: Collaboration
When somebody else has a clone
Git on your own is forgiving. The moment a colleague has a copy, the same commands start having consequences you cannot see from your terminal. This is the half where you learn to say what will happen before you press return — which push lands, which edits collide, which rewrite takes somebody else's afternoon with it.
- Modules
- 7
- Drills
- 8
- Build steps
- 9
- Time
- ~5h
Walk out able to
Predict a push before running it, resolve a conflict without losing a side, bisect a history to one commit, and get back work a force-push destroyed.
What stops being frightening
Remotes, fetch and push
A file on your disk that nobody else can move.
Proposals and conflicts
Which button leaves what, and whose lines are on top.
Bisect and hooks
Halve a history to one commit; read what stopped you.
Rewriting shared history
Which rewrites are safe, and how to undo one that was not.
The pitch
What you practise, and what you leave with
Three repositories, a colleague who force-pushes over your work, and the recovery — with the tree name that proves both sides survived.
You will practise
- Say what moved a tracking ref, and when
- Predict a push: land, reject, or create
- Predict whether two edits collide
- Count what a bisect verdict ruled out
Afterwards you can
- Read a divergence in both directions
- Resolve without losing either side
- Bisect a history down to one commit
- Rewrite safely, and repair one that was not
Modules
7 modules, 25 items
Lessons explain one idea. Drills repeat it until it sticks. Build steps make something that exists afterwards.
- 1
Two repositories, one model
~40 minSay what clone set up, and point at the file origin/main actually is.
- LessonWhy a second copy changes things5 min
- LessonA remote is a name for a place11 min
- Build stepMake a remote out of a directory12 min
- DrillSay what moved the tracking ref12 min
- 2
Fetch, then decide
~43 minRead a divergence both ways, and say whether your next push will be accepted.
- LessonFetch never touches your work16 min
- DrillPredict the push before you run it12 min
- Build stepGet a push rejected on purpose15 min
- 3
Proposing a change
~47 minSay what each merge button leaves behind, and prove all three leave the same files.
- LessonThree buttons, three commands15 min
- DrillCount what the trunk gains12 min
- Build stepLand one branch three ways20 min
- 4
When both sides edited it
~55 minPredict whether two edits collide, and resolve one without losing either side.
- LessonWhy a merge needs three versions15 min
- DrillPredict the collision13 min
- DrillSay whose lines are on top11 min
- Build stepResolve one so that both sides survive16 min
- 5
Finding the commit that broke it
~47 minHalve a history down to one commit, and say what each verdict ruled out.
- LessonBinary search over your own history14 min
- DrillCount what a verdict ruled out11 min
- Build stepBuild a history worth searching6 min
- Build stepBisect by hand down to one commit9 min
- Build stepHand the same search to a script7 min
- 6
Rules the repository runs
~25 minName the hook that stopped you, and say whether anyone else is running it.
- LessonWhat stopped you, and who else it stops14 min
- DrillName the hook, say if it can stop you11 min
- 7
Rewriting what other people have
~52 minSay which rewrites are safe from what a rewrite does, and repair one that was not.
- LessonEvery rewrite makes new names15 min
- DrillDecide whether this rewrite is safe12 min
- Build stepStage a force-push over somebody11 min
- Build stepRecover what a force-push took14 min
A taste of the code
$ git push origin main
To ../hub.git
! [rejected] main -> main (fetch first)
error: failed to push some refs to '../hub.git'$ git remote -v
origin ../hub.git (fetch) origin ../hub.git (push)
More in Tools & workflow
Keep going
Regex
Read the pattern. Then predict exactly what it does.
Intermediate~4h6 modules
Git: The Model
Stop memorising the commands. Learn what they move.
Intermediate~5h6 modules
VS Code
Stop guessing what the window just did.
Foundational~4h6 modules
JSON & YAML
Two formats you can read. Neither one means what you think.
Intermediate~4h5 modules
Two people, one history, and no surprises.
The first item is free. ~5h of focused work, at your own pace.
Intermediate~5h7 modules