How to Rename Local Git Branch?

0
2 min read

So, you’ve created a git branch but renamed it incorrectly? This article is for you! You’ve got good luck as Git allows to rename the Git Branch easily just by using the -m code. Let’s learn how to do it?

rename branch git

What is Branch Git?

branch in Git is simply a lightweight movable pointer to one of these commits.

How to Rename Branch Git?

If you are following my steps carefully then don’t worry you will be able to rename very easily. It just consists of few steps. Follow me:

    1. Switch to the Git that you want name to be changed.

    git checkout  <OLD-NAME>

  1.  Rename Branch Git. By using the following command.

git branch -m  <NEW-NAME>

3.  Delete the Old-name remote branch.

git push origin --delete <OLD-NAME>

4.  Insert <NEW-NAME> and reset the up-stream branch.

git push origin -u <NEW-NAME>

Now you’ve successfully renamed the local and remote git branch.


Latest:


Wind-UP

I hope you’ve understood to rename git branch. If you have any queries or suggestions related to this article feel free to contact our team. Contact Us page is for you. But while you are doing anything make sure you follow everything in this article carefully. Thanks for landing on this article. Have a nice day…Ahead.

LEAVE A REPLY

Please enter your comment!
Please enter your name here