1. Renaming the local branch

If you are in the branch you want to rename:

  git branch -m new_name

If you are outside the branch:

  git branch -m old_branch new_name

2. Delete the old_name branch in remote and push the new_name branch

  git push origin :old_name new_name

3. Reset the upstream branch for the new_name branch

  git push origin -u new_name