freeCodeCamp/guide/chinese/miscellaneous/rename-local-branches-in-git/index.md

534 B
Raw Blame History

title localeTitle
Rename Local Branches in Git 在Git中重命名本地分支

要重命名本地分支,请在终端中输入以下内容:

-m代表move就像mv在linux中用来重命名文件一样。

git branch -m <oldname> <newname> 

如果您已经签出了要更改的分支:

git branch -m <newname> 

下面是一个重命名feature/react-challenges分支来fix/react-hikes来自FreeCodeCamp的示例

git checkout feature/react-challenges 
 git branch -m fix/react-hikes