Shit Happens!! Sometimes, you named a branch wrong or want to make it more meaningful. Doing it locally is quite simple:
git branch -m new-branch-name
In case you are on a different branch, you can do it like this:
git branch -d old-branch-name new-branch-name
Rename the git branch on remote.
In some cases, you might have pushed your branch to remote, too; for that, you can run the following command to rename it on remote too:
git push origin :old-branch-name new-branch-name
To reset the upstream branch for the newly named local branch
Switch to the branch and then run the following command:
git push origin -u new-branch-name
Originally Posted On: MultipleStates