Skip to content

Instantly share code, notes, and snippets.

@tomasdev
Created December 23, 2013 14:38
Show Gist options
  • Save tomasdev/8098183 to your computer and use it in GitHub Desktop.
Save tomasdev/8098183 to your computer and use it in GitHub Desktop.
Renaming branches in Git.

References:

  • to_be_deleted BRANCH NAME TO BE DELETED
  • new_name NEW BRANCH NAME

SOMEONE

  1. Rename the branch locally git branch -m to_be_deleted new_name
  2. Push it to the remote git push origin new_name
  3. Delete the remote old git push origin :to_be_deleted
  4. Delete the local old git branch -D to_be_deleted

EVERYBODY

  1. Update all branches (this will trigger a 'your branch ref not found remotely') git pull
  2. Change to working name git checkout new_name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment