rename-branch

Rename the same local branch across many repositories.

Usagegit-wrangler rename-branch --oldbranch <name> --newbranch <name> [options]

Quick start

git-wrangler rename-branch --oldbranch master --newbranch main

What it does

rename-branch finds repositories with the old local branch name, previews the matches, and asks once before renaming them. A repository is skipped if the old branch is missing or the new name is already in use.

This command changes local branch names only. It does not rename or delete remote branches.

Options

Option Default What it does
--oldbranch <name> Required Choose the existing local branch.
--newbranch <name> Required Choose the new local branch name.
--repo <path> Whole workspace Target exactly one repository.
--yes, -y Off Skip the confirmation after the preview.
--guided Off Choose options through prompts.

More examples

# Rename one repository
git-wrangler rename-branch \
  --repo ./api \
  --oldbranch master \
  --newbranch main
  • Use rename-repo to rename GitHub repositories.
  • Use push when you are ready to publish the renamed branch.