Understanding Git Operations
Commit, branch and worktree are three objects wearing one word, and they cost wildly different amounts. What each one is, how a branch is meant to travel from creation to merge, and why a workflow driven by coding agents tends to stop halfway.
Understanding Git Operations
Commit, branch and worktree are three separate objects wearing one word, and they cost wildly different amounts. What each one is, how a branch is meant to travel from creation to merge, and why a workflow driven by coding agents tends to stop halfway.
Written for anyone whose coding agents open branches on their behalf. It assumes you can run a git command and have never had to think hard about what the commands mean.
01 / 05
Three things wearing one word
Start here, because every confusion further down is one of these being mistaken for another.
The work
A commit
weight — permanent
One saved change. Once made it stays in the repository whether or not anything points at it, which is why a tidy-up never puts work at risk.
The label
A branch
weight — about 40 bytes
A sticky note with one commit's address written on it. That is the whole thing. Deleting a branch throws away the note and leaves the work where it was.
The room
A worktree
weight — 0.24 to 4.6 GB
A second copy of the whole project as a folder on disk, so two jobs can run without tripping over each other. This is the one that fills an SSD.
| Term | What it is | What it costs | How you know it is finished |
|---|---|---|---|
| committhe work | One saved change, with a message. Permanent from the moment it is made. | nothing | It exists. That is the whole test. |
| branchthe label | A movable name pointing at one commit. Free to make, free to delete, free to have hundreds of. | ~40 bytes | Never, on its own. A branch is a bookmark, and bookmarks do not finish. |
| originthe copy | The hosted copy of the repository. A branch can live on your machine only, on the host only, or both. | a push | Pushed means a second machine has it. That is backup, and nothing more. |
| worktreethe room | A folder on disk with one branch open inside it, so an agent can work without disturbing your main checkout. | 0.24–4.6 GB | When its work is on the host, the folder has no further job. |
| mergedthe only finish | The work is now inside main, and everyone who clones the repository gets it. |
a deploy | This is the only word on the list that means done. |
The trap. Pushing a branch to the host feels like finishing. It moves the work somewhere safe and leaves it exactly as unfinished as it was.
The worked example
Every figure on this page comes from one observed case: a single repository after a month of work by coding agents. Twenty-nine branches had never been merged into anything, holding 278 commits between them, and the oldest had been sitting for four weeks.
Nothing had gone wrong technically. Every one of those branches had been pushed, so the work was safe on the host and no command had failed anywhere along the way. Each branch then stopped at the same next step.
02 / 05
The loop, and where it stops
The same picture twice. First the round trip a branch is meant to make, then the trip it made in the worked example, drawn to the same geometry so the missing half shows up as the shape of the gap.
Scroll the diagram sideways →
Scroll the diagram sideways →
Everything left of the push is automatic. The worktree opens itself, the agent commits, and on many setups a backup job commits again every half hour whether or not anyone asked. That stretch of the drawing runs on rails.
Right of the push there are no rails at all, and the second drawing is what that produces: a branch that reached safety and stopped, a room that never closed, and a main line carrying on above without any of it.
03 / 05
Where it breaks
A branch has a seven-step life. An agent setup runs the first three by itself and asks you for the other four.
Runs without you
The break
Nothing above this line needs a person. Below it, every step waits on one — with no reminder, no queue, and no failing check when it fails to happen.
Waits for you
The diagnosis. The setup automates creation and leaves closure to a person. Every session opens a room and none of them close one. That asymmetry compounds quietly, because an unmerged branch costs nothing until the disk fills or somebody needs the work.
The one habit worth changing is step five. A pull request is cheap, it is reversible, and it is the only place where “is this finished?” actually gets asked.
04 / 05
Which skills cover which step
Most of the loop already has a skill written for it, and five of them cover the steps that matter here.
A skill is a folder of written instructions an agent loads when the work in front of it matches. It carries no code of its own: it tells the agent which commands to run, in what order, and when to stop and ask. Skills install from public repositories, and the five below are all free to take.
Four of them ship together in the compound-engineering pack; the fifth comes from a separate collection. Between them they cover step one and steps four through six, which is most of the manual half of the loop.
| Skill | Step | What it does |
|---|---|---|
| ce-worktreecompound-engineering | 1 | Opens the room. It checks for existing isolation first, so it declines to make a redundant one, and it refuses to put one branch in two worktrees. |
| ce-commit-push-prcompound-engineering | 4 · 5 | Commits, pushes, opens the pull request and writes its description, in one call. It then hands the PR to the watcher below by default; babysit:off is the opt-out. |
| ce-babysit-prcompound-engineering | 6 | Watches an open pull request toward merge-ready, reacting to review comments, CI failures and base movement for as long as it stays open. It never merges: merge-readiness is not merge authorisation. |
| ce-resolve-pr-feedbackcompound-engineering | 6 | The review loop inside that. It judges each comment, fixes what is real, and escalates anything needing a human decision instead of stalling on it. |
| resolving-merge-conflictsmattpocock | 6 | What a four-week-old branch costs when it finally goes in: read both intents from the original commits and tickets, resolve every hunk, never abort. |
That sharpens the diagnosis. In the worked example the pile formed on a machine that already had all five of these installed. One call covers steps four and five, and it chains into the watcher for step six by itself. None of them was ever invoked at the end of a session, because they sit one step past the point where the work stopped, on the far side of the break. A skill that goes uninvoked is worth exactly as much as one you never installed.
Gap — step 7
Nothing routinely closes the room
ce-worktree names git worktree remove in a list of other operations and again in troubleshooting a path collision. ce-work cleans up only the sub-worktrees it spawned for parallel workers. Nothing sweeps the session's own room when the work has landed, and nothing deletes a merged label as a routine.
Gap — the view
Nothing answers “what is unmerged, and how old”
Every skill above acts on one branch or one pull request that you already have in mind. None of them stands back and reports the whole outstanding position. That report is the ageing schedule below, and it exists nowhere.
Approach with care
Guardrail hooks aim at the opposite failure
There are skills that install a hook blocking git push, reset --hard and branch -D outright. They guard against an agent pushing when it should not, which is a real risk and a different one. On a machine clearing a backlog like the one above, they would block every push and every deletion that work needs.
05 / 05
Read the backlog as an ageing schedule
An unmerged branch behaves like a receivable. It was earned and recorded, and it is worth less the longer it goes uncollected. So bucket it by age and read it the way a finance team reads debtors.
0–7 days
5 branches · 83 commits
8–14 days
5 branches · 73 commits
15–30 days
19 branches · 122 commits
The worked example: one repository, one month of agent sessions. Bars scale by branch count. Branches sharing history double-count.
Two thirds of the branches sit in the oldest bucket. That is the signature of a queue nobody is working, and it is what separates a backlog from a busy week. A backlog ageing this way keeps getting more expensive: the main line moves underneath every one of those branches, so the conflict each will eventually produce grows while nothing is happening.
The report itself is perhaps forty lines of script — list the unmerged branches, date each one by its last commit, bucket the dates. Run it weekly and the pile shows up in its second week, while it is still five branches instead of twenty-nine.
The whole page in one line. Automate the opening of rooms if you like, and put the same effort into closing them.