使用git-flow,是否可以重命名一个特性分支?
我尝试查找git flow help
和git flow feature help
,还有git-flow cheatsheet,但没有找到任何信息。
或者,直接使用git branch -m feature/new_name
是否安全?
使用git-flow,是否可以重命名一个特性分支?
我尝试查找git flow help
和git flow feature help
,还有git-flow cheatsheet,但没有找到任何信息。
或者,直接使用git branch -m feature/new_name
是否安全?
没错。
你可以这样做,但如果你推送了分支并且有人正在使用它,你需要告诉他们更新更改。
gitflow 分支与其他分支没有区别。
重命名本地分支
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 long git branch move (–move flag)
git branch --move <old_name> <new_name>
高级技巧:手动重命名分支
(不推荐——也就是说,不要在家里尝试!!!)
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 :-)
您可以使用git-flow feature rename NewFeatureName
来重命名一个功能。
这似乎没有很好的文档记录。您可以在这里找到参考资料。
是的,但如果您使用gitflow,您还需要手动修改(我不知道是否有自动方式)文件.git/config,并将git-flow功能名称重命名为要重命名的功能。