rename-branch

Renames a specified branch to a new name across repositories.

Usage

git-wrangler rename-branch --oldbranch <old_name> --newbranch <new_name>

What it does

Renames a specified branch to a new name across all managed Git repositories. Repositories where the old branch does not exist or the new branch name is already taken are skipped automatically.

Options

FlagRequiredDescription
--oldbranch <name>RequiredThe name of the existing branch to rename.
--newbranch <name>RequiredThe new name for the branch.

Example

# Rename 'master' to 'main' across all repos
git-wrangler rename-branch --oldbranch master --newbranch main

Notes

  • Repositories where the old branch doesn’t exist are skipped with a yellow warning
  • Repositories where the new branch name already exists are also skipped
  • This only renames the local branch — you’ll need git-wrangler push --force to update the remote