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.

Top Udemy Courses

JavaScript - The Complete Guide 2021 (Beginner + Advanced)
JavaScript - The Complete Guide 2021 (Beginner + Advanced)
64,026 students enrolled
52 hours of video content
View Course
React - The Complete Guide (incl Hooks, React Router, Redux)
React - The Complete Guide (incl Hooks, React Router, Redux)
284,472 students enrolled
40 hours of video content
View Course
Vue - The Complete Guide (w/ Router, Vuex, Composition API)
Vue - The Complete Guide (w/ Router, Vuex, Composition API)
152,857 students enrolled
48.5 hours of video content
View Course