This tutorial will help you to Rename a Git branch on a local repository. Also, we will apply the change to the remote git repository.

Rename a Git Branch in Local

You can use git branch -m followed by branch name to rename a git branch on your local repository. That’s it. You have successfully renamed the current branch in the local git repository. Again run git branch to list branch names.

Rename a Git Branch on Remote

First, rename the branch name in the local repository with the above instructions. Then push the new branch to the remote repository. Check your remote repository and you will find the new branch there. However, the old branch will still be visible. To fix this, remove the old branch by running the following command.

Conclusion

This tutorial describes you rename a Git branch on local and remote repositories.