Renaming a branch in GitHub

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

    You can do that without the terminal. You just need to create a branch with the new name, and remove the old after.

    Create a branch

    In your repository’s branch selector, just start typing a new branch name. It’ll give you the option to create a new branch:

    It’ll branch off of your current context. For example, if you’re on the bugfix branch, it’ll create a new branch from bugfix instead of master. Looking at a commit or a tag instead? It’ll branch your code from that specific revision.

    Delete a branch

    You’ll also see a delete button in your repository’s Branches page:

    As an added bonus, it’ll also give you a link to the branch’s Pull Request, if it has one.

    I just copied this content from: Create and delete branches

提交回复
热议问题