Renaming a Local GitHub branch and applying the change to its corresponding Remote branch

Hola!!!

So, this is a ‘Tutorialeto’ to help you rename your GitHub branches when suddenly your Program Manager asks you to change the names as per her standards(I know you hate that 😛 ).

git branch -m old_branch new_branch # Rename branch locally
git push origin :old_branch # Delete the old branch
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote

The following commands will help you accomplish the same. Enjoy!

Advertisements