Back to Handbook

Workflow · Intermediate

Git Branching Strategy

Safety Net

Using Git as a 'Save Point' system. How to branch, commit, and revert when AI hallucinations break your codebase.

01

The 'Save Point' Philosophy

In Vibecoding, Git isn't just for version history; it's your safety net. Before you ask the AI to make ANY change, you must save your state.

“Never prompt on a dirty tree. Commit or stash before every single AI request.”

— Vibecoding Rule #1

02

Feature Branch Workflow

Don't code on `main`. Create a throwaway branch for every AI session.

1. Branch

Create Feature

git checkout -b feature/new-idea

2. Prompt

Vibe Code

Let the AI generate the feature.

3. Verify

Test It

Does it work? If no, delete branch. If yes, merge.

4. Merge

Squash & Merge

Combine AI chaos into one clean commit on main.

03

Atomic Commits

AI tends to change 50 files at once. Force it to be atomic.

  • Why: If the AI breaks the login page while fixing the footer, you want to revert only the footer change.
  • Prompt: 'Implement this one specific change. Do not touch any other files. Run tests before confirming.'
  • Recovery: If the AI hallucinates, use `git reset --hard HEAD` to instantly wipe the bad code and try again with a better prompt.