Skip to main content

Claude Code Web On A New Repo Sets Default Branch Not To Main

llm

When I start projects using Claude Code web on new, empty GitHub repositories, I've noticed Claude sets the default branch to the branch it creates itself.

If you haven't set a Default branch (such as main) yet, Claude will set it to the branch it creates for the feature you've asked it to implement. This means all subsequent Claude Code sessions will start from that initial branch unless you change the default.

To avoid this, you have two options:

  • Before starting with Claude: Create a main branch when you create the repository and set it as the default. This ensures Claude's work branches off from main.
  • After starting with Claude: Create a main branch manually and set it as the default branch in your repository settings. Then, if needed, rebase or merge Claude's work onto main.