在git flow中重命名一个分支

And*_*imm 18 git branch git-flow

是否可以使用git-flow重命名功能分支?

我试图寻找了git flow helpgit flow feature help,也是混帐流的cheatsheet,但也没有什么.

或者,只是使用它是否安全git branch -m feature/new_name

Cod*_*ard 32

是的.

你可以这样做但是如果你推动你的分支并且有人正在使用它,你将需要更新它们的变化.

gitflow分支与任何其他分支没有什么不同.

Rename local branch

Git初学者(普通方式)

#Checkout new branch and delete the old one
git checkout -b <new_name>
git branch -D <old_name>

#Use the short git branch move (-m flag)
git branch -m <old_name> <new_name>

#Use the short git branch move (–move flag)
git branch --move <old_name> <new_name>
Run Code Online (Sandbox Code Playgroud)

Advanced: Manually rename branch

(不推荐 - 又名不要在家里试试!!!)

Rename the old branch under .git/refs/heads to the new name
Rename the old branch under .git/logs/refs/heads to the new name
Update the .git/HEAD to point to your new branch name.

Sit back and Enjoy GIT :-)
Run Code Online (Sandbox Code Playgroud)


小智 8

是的,但是如果您使用gitflow,还需要手动修改文件.git / config(我不知道是否有自动方法),并为想要的功能重命名git-flow功能名称改名


小智 8

可用于git-flow feature rename NewFeatureName重命名特征。

这似乎没有很好的记录。你可以在这里找到参考