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

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: