rename branch git on local and remote code example
Example 1: git rename branch
git branch -m <oldname> <newname> # Any Branch
git branch -m <newname> # Current Branch
# For windows if you get "Branch already exists" error
git branch -M <newname>
Example 2: rename remote branch in git
git push origin :<branch_to_rename>
git checkout -b <new_branch_name>
git push --set-upstream origin <new_branch_name>
Example 3: git rename a local branch
git branch -m <new-branch-name>