Skip to content

Instantly share code, notes, and snippets.

@mshRoR
Last active May 11, 2018 17:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mshRoR/4a4500aceee850ebd301c92d94f22b28 to your computer and use it in GitHub Desktop.
Save mshRoR/4a4500aceee850ebd301c92d94f22b28 to your computer and use it in GitHub Desktop.
Rename a local and remote branch in git
1. Rename your local branch.
If you are on the branch you want to rename: git branch -m new-name
or If you are on a different branch: git branch -m old-name new-name
2. Delete the old-name remote branch and push the new-name local branch.
git push origin :old-name new-name
3. Reset the upstream branch for the new-name local branch.
Switch to the branch and then: git push origin -u new-name
@mshRoR
Copy link
Author

mshRoR commented May 11, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment