StoicBuilder

HandbookIII the CastraGit branches

IIIthe Castra, Stay in control

Git branches

1 min readUpdated 28 November

In plain words

A branch is a separate line of work in your project where you can try a change without touching the version that already works.

Where you see it

The branch menu on GitHub shows main plus names like add-stripe or fix-login. Push a branch to a repo connected to Vercel and it gets its own preview link, while main keeps serving your real users.

Terminalterminal
git switch -c dark-mode# the agent works here, you commit as usualgit switch maingit merge dark-mode
The work happens on dark-mode. Main changes only when you merge.

What goes wrong

  1. Letting the agent work straight on main

    Every half-finished experiment lands in the version you deploy. If your host deploys main automatically, users see it within minutes.

  2. Branches left open for weeks

    Main keeps moving while the branch sits, and the merge ends in conflicts: two edits to the same lines that someone has to choose between. Agents tend to choose by guessing.

  3. Forgetting which branch you're on

    You ask for an urgent fix, it lands on last week's experiment, and production never gets it. Run git branch --show-current before you start.

What to tell your agent

Copy this into Lovable, Bolt, Cursor or any agent
Create a new branch named after this change before you edit anything, and do all the work there. When it works, tell me the branch name and how to merge it into main, but don't merge it yourself.

Quick check

Sign in to earn +10 XP for it

You want the agent to try a risky redesign of Chirp's feed. Where should it work?

Got a prompt that touches git branches?

Paste it. You get a better prompt first, then the cards that explain it.

Check your own prompt

Free, no sign-up.