How do I rename a local Git branch?

后端 未结 30 1207
轻奢々
轻奢々 2020-11-22 11:48

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

30条回答
  •  太阳男子
    2020-11-22 12:04

    Since you do not want to push the branch to a remote server, this example will be useful:

    Let's say you have an existing branch called "my-hot-feature," and you want to rename it to "feature-15."

    First, you want to change your local branch. This couldn't be easier:

    git branch -m my-hot-feature feature-15
    

    For more information, you can visit Locally and Remotely Renaming a Branch in Git.

提交回复
热议问题