Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EGit » Pulling master back in time(Messed up Git repository)
Pulling master back in time [message #787771] Tue, 31 January 2012 19:25 Go to next message
Peter Drake is currently offline Peter Drake
Messages: 7
Registered: October 2010
Junior Member
I've got a repository where HEAD is a predecessor of master. HEAD is the version I want to keep. How can I set master back to the previous version HEAD?
Re: Pulling master back in time [message #788048 is a reply to message #787771] Wed, 01 February 2012 04:37 Go to previous messageGo to next message
Christian Halstrick is currently offline Christian Halstrick
Messages: 93
Registered: July 2009
Member
checkout master and then reset the branch to the commit you want. Be careful: If you checkout master HEAD will point to master afterwards. You may loose your last reference to the commit you want to reset to. A safe method is: "create branch temp on current HEAD. checkout master. reset hard to temp. delete branch temp"

Ciao
Chris
Re: Pulling master back in time [message #789352 is a reply to message #788048] Thu, 02 February 2012 17:22 Go to previous messageGo to next message
Peter Drake is currently offline Peter Drake
Messages: 7
Registered: October 2010
Junior Member
Great -- that did the trick!

I'm not sure about the last step, though. How do I delete a branch?
Re: Pulling master back in time [message #789670 is a reply to message #789352] Fri, 03 February 2012 03:54 Go to previous messageGo to next message
Manuel Doninger is currently offline Manuel Doninger
Messages: 119
Registered: October 2010
Senior Member
In the Git Repositories view you open the Branches folder, select the branch you want to delete and do right click -> Delete Branch.
If there are commits in that branch, which you don't have merged to another (i.e. which you would lose on branch delete) you get a warning message, which you have to confirm.
Re: Pulling master back in time [message #789866 is a reply to message #789670] Fri, 03 February 2012 09:05 Go to previous message
R Shapiro is currently offline R Shapiro
Messages: 377
Registered: June 2011
Senior Member
Branches can also be deleted from the 'Branches' dialog. You can get there from the 'Checkout branch, tag, or reference' toolbar item (looks like an inverted pitch-fork) or from the 'Team -> Switch To -> Other...' right-click menu item.

As noted in the previous response, the underlying operation is like
git branch -d
as opposed to
git branch -D
You have to confirm the deletion if the branch has un-merged commits.
Previous Topic:How to remove nightly build, it has broken pushes...
Next Topic:Remote tracking branches not updated
Goto Forum:
  


Current Time: Fri Apr 18 04:05:19 EDT 2014

Powered by FUDForum. Page generated in 0.01716 seconds