Renaming a Branch in Git

Recently i had to rename a Branch in Git – i use (who i highly recommend for those looking for a free platform with lots of powerful features.

Make sure you have checkedout the branch you wish to rename

Step 1. Rename the current local branch

git branch -m new-branch-name

Step 2. Delete the remote brach and push the newly renamed branch

git push origin :old-branch-name new-branch-name

Step 3. Reset the upstream Branch to the new branch name

git push origin -u new-branch-name


Buy Me A Coffee
back arrowBack to Index