How do I rename a local Git branch?

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

    Probably as mentioned by others, this will be a case mismatch in branch naming.

    If you have such a situation, I can guess that you're on Windows which will also lead you to:

    $ git branch -m CaseSensitive casesensitive
    fatal: A branch named 'casesensitive' already exists.
    

    Then you have to do an intermediate step:

    $ git branch -m temporary
    $ git branch -m casesensitive
    

    Nothing more.

提交回复
热议问题