DEV Community

C Turner
C Turner

Posted on

How to rename your git branch

Thinking about renaming your default branch for your repo? You can do it 3 easy steps.
git branch -m stem
git push origin :master
git push --set-upstream origin stem

You might encounter an error that looks like this! Not to worry, this means that your default branch is set to master, and you need to change your repo settings.
Alt Text

Go to your repo, and switch to another branch as your default. Do your thang. Then update your default branch settings to the new branch you have made!
Alt Text

That's it! What did you rename your branch to? Drop a comment below. Like a comment if you renamed your branch to the same thing!

Top comments (1)

Collapse
 
catturner profile image
C Turner

stem