1. Rename
If it is your current branch, just do
git branch -m new_name
If it is another branch you want to rename
git branch -m old_name new_name
2. Track a new remote branch
- If your branch was pushed, then after renaming you need to delete it from the remote Git repository and ask your new local to track a new remote branch:
git push origin :old_name
git push --set-upstream origin new_name