Renaming a branch in GitHub

前端 未结 15 2351
面向向阳花
面向向阳花 2020-12-02 03:28

I just renamed my local branch using

git branch -m oldname newname

but this only renames the local version of the branch. How can I rename

15条回答
  •  天涯浪人
    2020-12-02 04:21

    This article shows how to do it real easy.

    1. To rename a local Git branch, we can use the Git branch -m command to modify the name:

       git branch -m feature1 feature2
      
    2. If you’re just looking for the command to rename a remote Git branch, this is it:

       git push -u origin feature2:feature3
      

      Check that you have no tags on the branch before you do this. You can do that with git tag.

提交回复
热议问题