Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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