Skip to content

Instantly share code, notes, and snippets.

@jameswilson
Forked from lttlrck/gist:9628955
Last active March 9, 2018 23:17
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 jameswilson/cbe1ab3d04b8723bd1c26005b01cb5a3 to your computer and use it in GitHub Desktop.
Save jameswilson/cbe1ab3d04b8723bd1c26005b01cb5a3 to your computer and use it in GitHub Desktop.
rename git branch locally and remotely
git checkout old_branch_name # Ensure you're on the local branch.
git branch -M new_branch_name # Rename branch locally.
git branch --unset-upstream # unset
git push origin :old_branch_name # Delete the old branch
git push -u origin new_branch_name # Push the new branch, set local branch to track the new remote
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment