Mechanisms of Vibe Coding featured image — Branch-per-experiment (Scale & tooling)Mechanisms of Vibe Coding featured image — Branch-per-experiment (Scale & tooling)

Part of Mechanisms of Vibe Coding

Mechanism: Branch-per-Experiment

One-sentence definition

Branch-per-experiment means each agent attempt, slice, or hypothesis gets its own git branch — so you can compare, abandon, or merge one outcome without entangling others.

The problem

One branch accumulates three approaches: Redis cache attempt, in-memory fix, and the actual solution. Commits are interleaved. You cannot merge the winner without cherry-picking through noise. Deleting bad work means surgery.

One branch for all vibes is one shared scratchpad — convenient until it isn’t.

Symptoms:

  • Branch name does not match current task
  • git log reads like a novel, not a PR
  • Hard to show colleague “approach A vs B”
  • Abandoning work feels expensive

How it works

  Hypothesis or slice
       │
       ▼
  branch experiment/
       │
       ├── merge (winner)
       ├── abandon (delete branch)
       └── compare (diff against base)

Naming: experiment/health-uptime-bootstrap, agent/verbose-health-slice-2 — searchable, disposable.

Pair with rollback: branch tip is the snapshot.

When to use it

When not to use it

  • Single linear slice already on a feature branch — one branch per feature is enough
  • Branch explosion without cleanup — delete abandoned experiments weekly

Failure modes

Branch hoarding — 40 stale experiment/*. Fix: Delete or archive; document winner.

Same branch, new experiment — Commit approach B on approach A’s branch. Fix: New branch from base.

Merge without compare — First finished branch wins. Fix: Verify + checkpoint against criteria.

Base drift — Experiments branch from old main. Fix: Rebase or branch from current target.

Minimal example

Context: Two ideas for uptime: read from process.uptime() vs custom startedAt.

Steps:

  1. experiment/health-uptime-process — agent implements A, test.
  2. experiment/health-uptime-started-at — fresh branch, agent implements B, test.
  3. Compare curls and diff size; merge one; delete the other.

Done when: Loser branch deleted without touching winner’s history.

Tool instances (optional deep-dive)

Portable idea above; this section is tool-specific. Date: June 2026.

Cursor

  • Agent on current branch; you create branch before agent starts.
  • git worktree for parallel local experiments without switching.

Other tools

GitHub compare view, git diff main...experiment/foo.

Related mechanisms

Try it yourself

Exercise: For your next “try another way” moment, create a new branch from base instead of continuing on the current one.

Done when: You can delete the failed branch with git branch -D guilt-free.

By TeacHER

TeacHER is the Neural Nexus learning guide, explaining AI tools, concepts, and workflows in clear, practical language. Every TeacHER article is made to help visitors understand AI without hype and try something useful for themselves.