How to change the current branch to master in Egit?

11,477

It should be possible by:

The OP Deco reports the appropriate process he followed:

  • Created a temp branch alongside the master branch
  • Right clicked and selected Team >'switch to' > 'master'
  • Chose hard reset and select the test branch.
Share:
11,477
Declan McKenna
Author by

Declan McKenna

I'm a passionate iOS Developer from Liverpool obsessed with mastering my craft and living abroad.

Updated on June 12, 2022

Comments

  • Declan McKenna
    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)

    enter image description here

  • Declan McKenna
    Declan McKenna about 12 years
    I'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
    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
    Declan McKenna about 12 years
    Thanks this worked: *Created a temp branch alongside the master branch *Right clicked and selected Team >'switch to' > 'master' *Chose hard reset and test.
  • VonC
    VonC about 12 years
    @Deco: excellent. i have updated my answer to include your process, for more visibility.
  • Declan McKenna
    Declan McKenna about 12 years
    It 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
    VonC about 12 years
    @Deco but the original master commit is referenced now by the temp branch, right?
  • Declan McKenna
    Declan McKenna about 12 years
    Yes it is. Not sure I see the use in this though.
  • Declan McKenna
    Declan McKenna about 12 years
    Reverting 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
    VonC about 12 years
    @Devo: but the process you followed precisely renamed test into master, did it not? And the old master was referenced by temp (that you created). And you can switched back to temp (your old master) at any time. What went wrong?
  • Declan McKenna
    Declan McKenna about 12 years
    It merely pushed master alongside test. Master held the same content it did before rather than tests content.
  • Declan McKenna
    Declan McKenna about 12 years
  • Declan McKenna
    Declan McKenna about 12 years
    Changed 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
    VonC about 12 years
    @Deco: ok, so you simply renamed test branch into master?
  • Declan McKenna
    Declan McKenna about 12 years
    Ye we have to delete it first. Would this have worked in the first place without the reset/ temp copy?