ProjectStack
git

fatal: A branch named ... already exists

You're trying to create a branch with a name that's already taken in this repository. Git doesn't allow duplicate branch names.

Common causes

  • You already created this branch previously
  • You're trying to create a branch from a different starting point but the name is taken
  • A teammate's branch was fetched and shows up as a remote tracking ref with the same name
  • A script or automation created the branch before you ran the command

How to fix it

  1. Switch to the existing branch: git checkout <branch-name>
  2. List all branches to see what exists: git branch -a
  3. Delete the old branch if it's safe: git branch -d <branch-name>, then create a new one
  4. Use a different name: git checkout -b <new-unique-name>

Example

fatal: A branch named 'feature/login' already exists.

Running git checkout -b feature/login when that branch was already created

Have a different error?

Paste any error message into the Error Translator to get an instant explanation.