If you want to rename a branch while pointed to any branch, do :
git branch -m <oldname> <newname>
If you want to rename the current branch, you can do:
git branch -m <newname>
Delete the oldname remote branch and push the newname local branch.
git push origin :oldname newname
Reset the upstream branch for the newname local branch.
Switch to the branch and then:
git push origin -u newname