Last updated on Sep 8, 2022 by Suraj Sharma
In this tutorial, you will learn how you can rename an existing git branch in your local system.
First, checkout to the branch you want to rename
git checkout branch-to-rename
To rename the git branch, run the following command
git branch -m new-branch
-m is an alias for --move
To push the newly renamed branch to remote
git push origin -u new-branch
Finally, to delete your old branch from the remote
git push origin --delete branch-to-rename
Rate this post
Suraj Sharma is a Full Stack Software Engineer. He holds a B.Tech degree in Computer Science & Engineering from NIT Rourkela.