How do I rename a local Git branch?

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

    To rename the current branch (except for detached HEAD state) you can also use this alias:

    [alias]
        mvh = !sh -c 'git branch -m `git rev-parse --abbrev-ref HEAD` $1'
    

提交回复
热议问题