• Now all data be ready for publish, We had made our blog alive now. Haha.

  • These days CCP GFW blocked all the IPs from US and when I switch my IP in google Cloud, the disk data cannot be restore again. I have to restart my blog totally, Now the website is still building…

How do I rename a local Git branch?- Stack Overflow

Python PingBook 1 months ago (10-26) 15 0


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 which hasn’t been pushed to a remote branch?

In case you need to rename remote branch as well:
How do I rename both a Git local and remote branch name


If you want to rename a branch while pointed to any branch, do:

git branch -m

If you want to rename the current branch, you can do:

git branch -m

A way to remember this is -m is for “move” (or mv), which is how you rename files.

If you are on Windows or another case-insensitive filesystem, and there are any capitalization change in the name, you need to use -M, otherwise, git will throw branch already exists error:

git branch -M

Copyright from PingBook Blog, If not specified, they are original. This site uses BY-NC-SAProtocol authenticated.
For reprinting, please indicate the link of the original text:How do I rename a local Git branch?- Stack Overflow
LIKE (0)
We create, We sharing! Tag every value data your sharing
Submit comments
Cancel comments
emoji picture bold strikethrough center italic check in

Hi,you need to provide your name and email adress!

  • Name (Required)
  • Email (Required)
  • Website