我如何重命名尚未被推到远程仓库的本地分支 ?
相关:
当前回答
在视觉演播室:
· 管理处 _______________________________________________________________________________________________________________________您的仓库 → 您的分支重命名
其他回答
重命名本地分支GitHub 桌面桌面,单击现任分处选项卡 (当前仓库右侧) , 右键单击您想要重命名的分支, 右键单击重命名 。 然后您会被弹出提示到可以重命名的位置 。
这里有三个步骤:命令, 您可以在终端内调用, 更改分支名称 。
git branch -m old_branch new_branch # Rename branch locally
git push origin :old_branch # Delete the old branch
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote
如果需要更多的话:一步一步,如何更改 Git 分支名称这是一篇关于这个的好文章。
所有你必须做的是三步:
.git/refs/heads
新名称.git/logs/refs/heads
新名称.git/HEAD
导致您新分支名称要重命名当前分支( 除独立 HEAD 状态外) 您也可以使用此别名 :
[alias]
mvh = !sh -c 'git branch -m `git rev-parse --abbrev-ref HEAD` $1'
git branch -m <new_name>
这将为您正在工作的当前分支设定新名称 。
git branch -m <old_name> <new_name>
您必须在此提供旧的分支名称和新分支名称 。