How do I rename a local Git branch?

后端 未结 30 1450
轻奢々
轻奢々 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条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-11-22 12:15

    All of the previous answers are talking about git branch -m. Of course, it's easy to operate, but for me, it may be a little hard to remember another Git command. So I tried to get the work done by the command I was familiar with. Yeah, you may guessed it.

    I use git branch -b . And if you don't want to save the old branch now you can execute git branch -D to remove it.

    I know it may be a little tedious, but it's easier to understand and remember. I hope it‘s helpful for you.

提交回复
热议问题