- if on branch: git branch -m new-name (Rename branch locally)
OR
- if on master branch: git branch -m old_branch new_branch (Rename branch locally)
THEN
- git push origin :old_branch (Delete the old branch on remote)
- Switch to branch git branch --unset-upstream (Need for some versions of git)
- Switch to branch git push --set-upstream origin new_branch (Push new branch to origin and set local branch to track the new remote)