我如何重命名尚未被推到远程仓库的本地分支 ?
相关:
当前回答
所有你必须做的是三步:
.git/refs/heads
新名称.git/logs/refs/heads
新名称.git/HEAD
导致您新分支名称其他回答
如果您想要更改当前分支的名称,请运行 :
git branch -m [old_branch] [new_branch]
如果您想要删除旧的远程分支,请运行 :
git push origin :[old_branch]
如果您想要删除旧的远程分支并创建一个新的远程分支,请运行 :
git push origin :old_branch new_branch
重命名当前分支 :
git branch -m <newname>
将指定给任何分支的分支重新命名 :
git branch -m <oldname> <newname>
-m
短为--move
.
推动地方分支并重设上游分支:
git push origin -u <newname>
删除远程分支 :
git push origin --delete <oldname>
创建git rename
别名 :
git config --global alias.rename 'branch -m'
在 Windows 或其他不区分大小写的文件系统上使用-M
如果名称仅出现资本化变化, 则该名称只有资本化变化 。 否则, Git 将投"部门已经存在"错误 。
git branch -M <newname>
高级 Git 用户可以手动重命名 :
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 yout new branch name
重命名本地分支 :
git branch -m <old_branch_name> <new_branch_name>
按下新分支 :
git push --set-upstream origin <new_branch_name>
所有你必须做的是三步:
.git/refs/heads
新名称.git/logs/refs/heads
新名称.git/HEAD
导致您新分支名称