如何在Git中再次将分支作为主分支? [英] How do I make a side branch my master branch again in Git?
本文介绍了如何在Git中再次将分支作为主分支?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的项目向南,所以我创建了一个名为F ***** UP的分支。现在这是一个很好的分支,所以我想备份Master,并再次使F ***** UP成为主分支。如何在Git命令行上执行此操作?适用于Windows的Git。
My project went south, so I created a branch called F*****UP. Now that is the good branch, so I would like to back up Master, and make F*****UP the master branch again. How to I do this on the Git command line? Git for Windows that is.
推荐答案
您可以使用git branch -m oldname newname
重命名分支(或者只是git branch -m newname
如果要重命名当前分支)。你也可以这样做:
You can rename branches usinggit branch -m oldname newname
(or justgit branch -m newname
if you want to rename the current branch). You can do that here too:
git branch -m master oldmaster
git branch -m F*****UP master
请注意,如果你想现在推送上游,你必须强制推送(通过将 -f
参数添加到 git push
)。
这篇关于如何在Git中再次将分支作为主分支?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文