# Renaming both a local and remote branch First, rename the local branch by typing: ```bash git branch -m ``` Then push the new branch to the remote repository: ```bash git push origin ``` 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. ** ```bash git push origin : ``` Finally, reset the upstream branch for the new_name local branch: ```bash git push origin -u ``` # Renaming a remote branch If you only want to rename a remote branch, you can do so by: ```bash git push origin : git push origin : ``` Finally, reset the upstream branch for the new_name local branch: ```bash git push origin -u ```