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 2020 (Beginner + Advanced)
JavaScript - The Complete Guide 2020 (Beginner + Advanced)
26,545 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)
221,520 students enrolled
44 hours of video content
View Course
Vue JS 2 - The Complete Guide (incl. Vue Router & Vuex)
Vue JS 2 - The Complete Guide (incl. Vue Router & Vuex)
114,575 students enrolled
21 hours of video content
View Course