How to change the current branch to master in Egit?
11,477
It should be possible by:
-
creating a new branch on 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)
The OP Deco reports the appropriate process he followed:
- Created a
temp
branch alongside themaster
branch - Right clicked and selected
Team >'switch to' > 'master'
- Chose
hard reset
and select thetest
branch.
Author by
Declan McKenna
I'm a passionate iOS Developer from Liverpool obsessed with mastering my craft and living abroad.
Updated on June 12, 2022Comments
-
Declan McKenna almost 2 years
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)
-
Declan McKenna about 12 yearsI've created a branch temp that has appeared beside the master branch. (Should this be on top instead?). I'm unsure how to go about resetting to the test branch. I right click master and my only options appears to be 'soft' 'mixed' or 'hard'. Which should I pick if any? Will I be asked later to reference the test branch?
-
VonC about 12 years@Deco: the documentation states: Select Team -> Reset... on a project. This opens a dialog where you can select a branch or a tag. An hard reset will change the index and your working tree to your new branch content. Make sure you have created a branch on top of master first, and that you don't have any private (ie not-versioned) files in your working tree first: they would be erased.
-
Declan McKenna about 12 yearsThanks this worked: *Created a temp branch alongside the master branch *Right clicked and selected Team >'switch to' > 'master' *Chose hard reset and test.
-
VonC about 12 years@Deco: excellent. i have updated my answer to include your process, for more visibility.
-
Declan McKenna about 12 yearsIt didn't work all my work up until the original master node commit is gone :( I copied the eclipse project folder before hand so all is not lost like.
-
VonC about 12 years@Deco but the original
master
commit is referenced now by the tempbranch
, right? -
Declan McKenna about 12 yearsYes it is. Not sure I see the use in this though.
-
Declan McKenna about 12 yearsReverting to the test branch fixed things back to how they were. Looking back at my question I may not have been clear enough. I merely wanted to rename my test branch as the master branch and remove the original master branch. It seemed abit silly having my main branch being called test.
-
VonC about 12 years@Devo: but the process you followed precisely renamed
test
intomaster
, did it not? And the oldmaster
was referenced bytemp
(that you created). And you can switched back totemp
(your oldmaster
) at any time. What went wrong? -
Declan McKenna about 12 yearsIt merely pushed master alongside test. Master held the same content it did before rather than tests content.
-
Declan McKenna about 12 years
-
Declan McKenna about 12 yearsChanged the steps needed. I have the feeling I've overcomplicated this and you misunderstood my question. The master branch could have been deleted as long as this didn't affect my test branch. I wanted the test branch to be my only branch and to rename it master.
-
VonC about 12 years@Deco: ok, so you simply renamed
test
branch intomaster
? -
Declan McKenna about 12 yearsYe we have to delete it first. Would this have worked in the first place without the reset/ temp copy?