How do I rename a local Git branch?

后端 未结 30 1603
轻奢々
轻奢々 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:14

    Just three steps to replicate change in name on remote as well as on GitHub:

    Step 1 git branch -m old_branchname new_branchname

    Step 2 git push origin :old_branchname new_branchname

    Step 3 git push --set-upstream origin new_branchname

提交回复
热议问题