git 如何在Egit中将当前分支更改为master?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/9278472/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to change the current branch to master in Egit?
提问by Declan McKenna
I want to know how to do this in Egit the eclipse plugin. This question has been asked many times for git but the answers involve some form of command language I do not have access to or know. Using the eclipse interface how can I make the test branch the master branch without taking on the original master branches flawed code (ie no merging)
我想知道如何在 Egit eclipse 插件中执行此操作。对于 git,这个问题已经被问过很多次,但答案涉及某种形式的命令语言,我无法访问或知道。使用eclipse接口如何使test分支成为master分支,而不需要承担原来的master分支有缺陷的代码(即不合并)
采纳答案by VonC
It should be possible by:
应该可以通过:
- creating a new branchon top of your current
master
(in order to not lose the HEAD of that branch) - resetting the
master
branch to thetest
branch(the commits won't be lost, since they are referenced by the new local branch you just created)
- 在当前分支之上创建一个新分支
master
(为了不丢失该分支的 HEAD) - 复位
master
分支的test
分支(该提交不会丢失,因为它们是由您刚刚创建的新本地分支参考)
The OP Decoreports the appropriate process he followed:
该OP德科报告的适当过程中,他遵循:
- Created a
temp
branch alongside themaster
branch - Right clicked and selected
Team >'switch to' > 'master'
- Chose
hard reset
and select thetest
branch.
- 在
temp
分支旁边创建了一个master
分支 - 右键单击并选择
Team >'switch to' > 'master'
- 选择
hard reset
并选择test
分支。