Quickstart Publish your first site with Claude Code

Step 3 · Just enough Git

The main branch

Your live site is published from one branch, main. Your changes reach the site only when they reach main.

Time: 5 min

A branch is a parallel line of work in the same repo. You can make changes on a branch without touching the main line. main is the line GitHub Pages publishes from, so your site updates only when main changes.

Make sure it's called main

Repos you create on GitHub, and forks of the starters, already use main. On the VS Code path, Git, Node & GitHub CLI set your computer to use main for new repos too. If you ever have the agent start a repo from scratch, name the folder and the branch:

Say this
In the your-repo folder, start a new git repository on a branch named main.

The app path: Claude's own branch

In the Claude app, Claude works on its own branch, named claude/…, and pushes that branch, not main. Your site doesn't change until the work is merged into main.

A claude branch splits off main and merges back A line labeled main runs from top to bottom on the left. Its first point is your site as it is now. A branch named claude/… splits off to the right and gets two commits: new timeline, then fix a date. While Claude works on the branch, the live site on main is unchanged. A curve labeled pull request, then merge, joins the branch back into main. At that point main updates, and so does your site. main Your site as it is now claude/… branch Live site unchanged while Claude works Commit: new timeline Commit: fix a date Pull request → merge main updates, and so does your site
Claude's commits wait on its own branch. Merging them into main is what updates your site.

Two ways to get work onto main

Straight to main

The simplest way for a project only you work on. Say it with the task, or at the start of the session:

Say this
Commit and push to main.

Through a pull request

Let Claude push its claude/… branch, then say:

Say this
Open a pull request from your branch into main of your-username/your-repo (my repo, not the original) and merge it.

Or open the diff view, the panel that shows what Claude changed, and select Create PR at the top. Then open the pull request on GitHub, click Merge pull request, then Confirm merge.

On the VS Code path the agent usually works on main already, so "Commit and push to main." is all you need.

If it goes wrong

The agent says it can't push to main

Use the pull request way instead:

Say this
Push your branch, then open a pull request from it into main of your-username/your-repo (my repo, not the original) and merge it.
The agent pushed, but my site didn't change

The work is probably still on a claude/… branch. Ask:

Say this
Which branch is my work on? Get it onto main and push main.

After main changes, give GitHub Pages up to 10 minutes.

What the agent runs for you
# A new repo that starts on main
git init -b main
git config --global init.defaultBranch main   # every new repo from now on

# Pull request, then merge (GitHub CLI). Naming the repo keeps a fork's
# pull request out of the original repo.
gh pr create --repo your-username/your-repo --base main --fill
gh pr merge branch-name --repo your-username/your-repo --merge

On the app path, Claude may use its built-in GitHub tools for the pull request instead.

Saved only in this browser.