Skip to content

Latest commit

 

History

History
24 lines (17 loc) · 448 Bytes

rename-existing-branch.md

File metadata and controls

24 lines (17 loc) · 448 Bytes

Rename an existing branch

If your current branch is master and you want to rename it to main, use this command.

git branch -m master main

Note: You must have at least one commit on the master branch. If you don't, you'll see this error message.

error: refname refs/heads/master not found
fatal: Branch rename failed

Reference

Found in the git 2.26.0 manual. To access the help:

git branch --help