Renaming Git Branch

Follow the steps below to rename a Local and Remote Git Branch:

01 Start by switching to the local branch which you want to rename:

git checkout <old_name>

02 Rename the local branch by typing:

git branch -m <new_name>

  

03. Push the <new_name> local branch and reset the upstream branch:

git push origin -u <new_name>

 

04. Delete the <old_name> remote branch:

git push origin --delete <old_name>

 

来源: https://linuxize.com/post/how-to-rename-local-and-remote-git-branch/

posted on 2022-11-16 17:03  晴空半岛  阅读(13)  评论(0编辑  收藏  举报