Skip to main content
CodeOath
← All posts

Git95 min total · 17 parts

Git Internals and Workflows: Branching, Merging, and Rebasing

Part 1 of 17 · ~2 min

Overview

Git has a reputation problem, and it is not really Git's fault. Most people meet it as a list of recipes — git add, git commit, git push, and a StackOverflow answer for whenever those three stop working. The recipes are fine right up until the day something goes sideways, and then you are typing commands you do not understand into a repository you cannot afford to break.

The way out is not more recipes. It is a model. Underneath all of it, Git is doing something small and consistent, and once that shape is visible, the commands stop reading like incantations and start reading like exactly what you would type if you already knew how to say what you meant.

So rather than demonstrate that on sixteen disconnected snippets, we are going to follow one repository through one real stretch of work.

The repository is shiftplan — a shift-scheduling app for small clinics and cafés. Three people work on it: you, Nadia, and Theo. Customers self-host it, which means shiftplan ships numbered releases rather than deploying continuously, and there is still a release/2.2 branch alive because plenty of clinics have not upgraded yet. Here is the repo the morning this story starts:

git log --oneline --graph --all
* a4f1c0e (HEAD -> main, origin/main) Virtualise the roster grid
* 91b7d40 Add CSV import for staff lists
* 6e2ac18 Fix off-by-one in the week picker
| * 2fd9e07 (origin/release/2.2, release/2.2) Backport: week picker fix
|/
* d5c8b31 (tag: v2.2.0) Release 2.2.0

Your job this week is shift swapping: let an employee offer a shift they cannot work, and let a colleague claim it. One feature, one branch, one week — and over that week it will hit a merge conflict, a rebase that inverts everything you just learned, six commits that need to become two, a force-push that nearly destroys a colleague's work, a production incident, and about ten minutes where four commits appear to have vanished permanently.

Every one of those is a chapter. None of them is a toy. Work through it in order if you can, because the repository genuinely accumulates and a later chapter often cleans up a mess an earlier one left on purpose. If you landed here from a search, the sidebar will drop you straight into what you need — each chapter says where in the week it is, so you can pick up the thread from anywhere.