I don\'t want to rename a remote branch, as described in Rename master branch for both local and remote Git repositories.
How can I rename a local branch wh
Before we begin, make sure you’ve selected the branch you want to rename:
git checkout old-name
If you want to see all of your local branches, use the following command:
git branch --list
When you’re all clear, follow these steps:
Using the Git rename branch command will require you to add an -m option to your command:
git branch -m new-name
You can also rename a local branch from another branch by using the following two commands:
git checkout master
git branch -m old-name new-name
Lastly, this command will list all — both local and remote — branches to verify that it has been renamed:
git branch -a
Although it isn’t possible to rename a remote branch directly, the process of renaming one involves these three easy steps:
To start, you will need to rename a local branch by following the previous steps. 2.Then delete the old branch and push the new one. You can do this easily with the following commands:
git push origin --delete old-name
git push origin :old-name new-name
Reset the upstream branch for your new local branch and you will be all set:
git push origin -u new-name