How do I rename a local Git branch?

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

    Advanced Git users can rename manually using:

    Rename the old branch under .git/refs/heads to the new name
    
    Rename the old branch under .git/logs/refs/heads to the new name
    
    Update the .git/HEAD to point to yout new branch name
    

提交回复
热议问题