Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

How to change the name of git Branch

Shulou Source: shulou.com Published: 2022-06-01 03:07:04 09月26日 Update

This article mainly introduces the git branch how to change the name of the relevant knowledge, the content is detailed and easy to understand, the operation is simple and fast, has a certain reference value, I believe you will gain after reading this git branch how to change the name of the article, let's take a look at it.

Method: 1, use branch operation to modify the local branch name, syntax is "git branch-m old name new name"; 2, delete the remote branch and use the "git push origin new name" command to modify the remote branch name.

This article operating environment: Windows10 system, Git2.30.0 version, Dell G3 computer.

How to change the name of git Branch

Suppose the branch name is oldName

Want to change it to newName

1. Local branch rename (not yet pushed to remote)

Git branch-m oldName newName

two。 Remote branch rename (remote has been pushed-assuming the local branch and the remote corresponding branch name are the same)

a. Rename the local branch corresponding to the remote branch

Git branch-m oldName newName

b. Delete remote branch

Git push-delete origin oldName

c. Upload a newly named local branch

Git push origin newName

d. Associate the modified local branch with the remote branch

This is the end of git branch-set-upstream-to origin/newName 's article on "how to change the name of git Branch". Thank you for reading! I believe you all have a certain understanding of the knowledge of "how to change the name of the git branch". If you want to learn more, you are welcome to follow the industry information channel.

Tags: Branch name knowledge content name article same value command easy to operate article method easy to understand more environment computer see system industry grammar Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Technology vpn Docker MySQL Microsoft