Skip to content

Instantly share code, notes, and snippets.

@andmax
Created September 28, 2020 12:33
Show Gist options
  • Save andmax/36c43635e37acc33526af7a70c211777 to your computer and use it in GitHub Desktop.
Save andmax/36c43635e37acc33526af7a70c211777 to your computer and use it in GitHub Desktop.
Rename an existing git branch
1. The problem is to rename a git branch named <current_branch_name>
2. that already exists to a new name <new_branch_name>:
git checkout <current_branch_name>
git branch -m <new_branch_name>
git push origin -u <new_branch_name>
git push origin --delete <current_branch_name>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment