ItSolutionStuff.com

How to Rename Branch Name in Git Command?

By Hardik Savani • April 23, 2022
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: Git
Hardik Savani

Hardik Savani

I'm a full-stack developer, entrepreneur, and founder of ItSolutionStuff.com. Passionate about PHP, Laravel, JavaScript, and helping developers grow.

📺 Subscribe on YouTube

We Are Recommending You

How to Create a New Branch on GitHub?

Read Now →

How to Clone Github Repository using Command Line?

Read Now →

How to Ignore Wildcard Files Name in Git using Gitignore?

Read Now →

How to Ignore Folder in Git using Gitignore?

Read Now →

How to Ignore File in Git using Gitignore?

Read Now →

How to Git Ignore Some Files Locally?

Read Now →

How to Clone a Git Repository into a Specific Folder?

Read Now →

How to Clone Laravel Project from Github on Server?

Read Now →

How to Add Git Add Remote Origin on Bitbucket Repository?

Read Now →

Git - How to Find a Deleted File in Commit History?

Read Now →

How to Configure Git Username and Email?

Read Now →

How to Git Force Pull from Remote Branch?

Read Now →