Check on which branch you are:
git branch --show-currentCheckout to the branch you want to rename and rename:
git checkout branch_to_rename
git branch -m new_namePush the changes:
git push -u origin :old_name new_nameWhy ”:“?
- :old_name means delete the branch named old_name from the remote. You’re specifying that there is no local source for old_name, so Git interprets this as a deletion request.
- new_name (without the colon) means push the local branch named new_name and create/update a remote branch with the same name new_name.