For more details on this procedure.
How to rename a local branch in Git
To rename the current branch, make sure you’ve checked out and are using the branch you want to rename.
git checkout oldbranchAnd then
git branch -m newbranchIf you want to, you can rename a branch when you’re working in another branch.
git branch -m oldbranch newbranch
How to rename a remote branch in Git
If others use this branch and commit to it, you should pull it before renaming it locally. This ensures that your local repository is updated and that changes made by other users will not be lost.
First, we need to delete
oldbranchfrom the remote repository, and pushenwbranchnewbranchto the remote.git push origin --delete oldbranchNow we’ll push the new one to the remote, by using -u (set upstream) option.
git push origin -u newbranch