First, rename the local branch by typing:
git branch -m <old_name> <new_name>
Then push the new branch to the remote repository:
git push origin <new_name>
Delete the old branch on the remote repository: ** NOTE: With GitHub, you can't delete a branch through the web interface if it's the default branch of the repository. You can change the default branch in the repository settings. **
git push origin :<old_name>
Finally, reset the upstream branch for the new_name local branch:
git push origin -u <new_name>
If you only want to rename a remote branch, you can do so by:
git push origin <old_name>:<new_name>
git push origin :<old_name>
Finally, reset the upstream branch for the new_name local branch:
git push origin -u <new_name>