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

相关:


当前回答

要重命名您的当前分支 :

git branch -m <newname>

其他回答

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

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

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

在PhpStorm中:

VCS你的支节重命名

要重命名当前分支( 除独立 HEAD 状态外) 您也可以使用此别名 :

[alias]
    mvh = !sh -c 'git branch -m `git rev-parse --abbrev-ref HEAD` $1'

要重命名本地分支 :

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

现在你也必须在远程服务器上传播这些变化。

将已删除的旧分支的更改推到下方 :

git push origin :[old-branch]

推动新分支创建的变更 :

git push origin [new-branch]

如果您愿意使用源树树你可以右键单击分支并选择“改名 ” 。

enter image description here