To rename a git branch locally type the following:

git branch -m <new_branch_name>

Example of renaming a local git branch

Let’s say we had a branch patch_stikcynavbar and we want to fix the spelling then we just type:

git checkout patch_stikcynavbar
git branch -m patch_stickynavbar

Example of renaming a remote git branch

First, we rename the branch locally. Then, we push the renamed branch to remote and afterwards we delete the old branch. So

git push origin patch_stickynavbar
git push origin --delete patch_stikcynavbar