Renaming a branch in GitHub

前端 未结 15 2343
面向向阳花
面向向阳花 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:23

    Here is what worked for me:

    1. Create the new branch first:

      git push github newname :refs/heads/newname
      
    2. On the GitHub site, go to settings and change the Default branch to newname

    3. Delete the oldname

      git push github --delete oldname
      

提交回复
热议问题