我如何重命名尚未被推到远程仓库的本地分支 ?

相关:


当前回答

在视觉演播室:

· 管理处 _______________________________________________________________________________________________________________________您的仓库您的分支重命名

其他回答

git branch -m [old-branch] [new-branch]

-m 意指全部从[旧部门]移动到[新部门],并记住您可以使用 -M 用于其他文件系统。

如果您想要:

  • 重命名 Git 仓库, 运行 :git branch -m <oldname> <newname>
  • 删除旧分支 :git push origin: old-name new-name
  • 提交使用 :git commit <newname>
    • 并按下使用 :git push origin new_branch_name:master
  • 如果您想要检查状态, 请使用 :git status
  • 如果您想要检查退出, 请使用 :git checkout

重命名本地分支GitHub 桌面桌面,单击现任分处选项卡 (当前仓库右侧) , 右键单击您想要重命名的分支, 右键单击重命名 。 然后您会被弹出提示到可以重命名的位置 。

enter image description here

我愚蠢地命名了一个树枝 从连字符开始, 然后检查了主人。删除删除我的分支,我有工作在里面。

这两种办法都行不通:

git checkout -dumb-name

git checkout -- -dumb-name

"s,'s 和 s , s 和 s\也没有帮助。git branch -m没有工作。

我终于把它修好了。 进入您的工作副本 . git/ refs/ heads, 找到文件名“ - dumb- name ” , 获取分支的大麻。 然后, 这将检查它, 制造一个新的有正常名称的分支, 并删除旧的分支 。

git checkout {hash}
git checkout -b brilliant-name
git branch -d -- -dumb-name

吉特・伊特的反派命令 试试这个 对我有用

默认分支已被重新命名 ! { oldBranchName} 现在命名为{ newBranchName} 如果您有本地克隆, 您可以运行以下命令来更新它 。

git branch -m {oldBranchName} {NewBranchName}
git fetch origin
git branch -u origin/{NewBranchName} {NewBranchName}
git remote set-head origin -a