by Sai gowtham

How to rename a Local Branch in Git

In this tutorial, we are going to learn about how to rename a local branch in git.

Renaming Git Local Branch

To rename a local branch you need to use the git branch command followed by the -m flag and old-branch-name, new-branch-name.

git branch -m line work

Now our old branch name line is changed to work.

If you are in the same branch and you need to rename it you can use git branch command followed by the new-branch-name.

git branch -m work

Now our branch name is changed to work.