How to Rename Branch Name in Git Command?

By Hardik Savani April 23, 2022 Category : Git

This article is focused on how to rename branch name in git command. I explained simply about how to change branch name in git command. if you have question about git command to change branch name then I will give simple example with solution. This article will give you simple example of git rename branch command line. follow bellow step for git command rename branch.

In this tutorial, we will use git branch command rename branch in github repository. we will use git command to change branch name into github. so let's follow below step to rename branch in git.

Clone Git Repository(Optional):

If you are new and you haven't create or clone github repository yet then you can follow bellow tutorial:

Github Create or Clone Git Repository.

Rename Branch using Git Command:

First i will show you "git branch" command to check which branch currently active, then you can change branch name. let's run below command:

git branch

Now, we will change branch name "dev" to "dev-change" branch, let's see bellow command:

Syntax:

git branch -m <new-name>

Example:

git branch -m dev-change

You can see below layout:

Let's see created new branch in Github Repository List:

I hope it can help you...

Tags :
Shares