How to rename a git local and remote branch?

By | July 21, 2021

As we are working in a team and using git. Many developers are working on the same project in this git is very helpful. So when we have to rename the git branch? You created a branch and pushed on the remote server, after pushing you got to know that branch name is incorrect. To rename the branch you can use following steps.

Step 1. If you are in branch A and want to rename branch B

git branch -m <oldname> <newname>

If you want to rename the current branch

git branch -m <newname>

7 thoughts on “How to rename a git local and remote branch?

  1. Latest Hairstylery

    Great post however I was wanting to know if you could write a litte more on this subject? I’d be very thankful if you could elaborate a little bit further. Appreciate it!

  2. Fashion Styles

    Hi! This is my first visit to your blog! We are a team of volunteers and starting a new project in a community in the same niche. Your blog provided us useful information to work on. You have done a extraordinary job!

Leave a Reply