我如何重命名本地Git分支? [英] How do I rename a local Git branch?
本文介绍了我如何重命名本地Git分支?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我不想重命名远程分支,如 为本地和远程Git存储库重命名主分支 。
我怎样才能重命名一个没有推送到远程分支的本地分支?
如果你想重新命名一个分支同时指向任何分支,请执行: git branch -m< oldname> < NEWNAME>
如果您想重命名当前分支,您可以这样做:
git branch -m< newname>
记住这一点的方法是 -m
是为移动(或 mv
),这是您如何重命名文件。
I don't want to rename a remote branch, as described in Rename master branch for both local and remote Git repositories.
How can I rename a local branch which hasn't been pushed to a remote branch?
解决方案
If you want to rename a branch while pointed to any branch, do:
git branch -m <oldname> <newname>
If you want to rename the current branch, you can do:
git branch -m <newname>
A way to remember this, is -m
is for "move" (or mv
), which is how you rename files.
这篇关于我如何重命名本地Git分支?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文