Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EGit / JGit » Pulling master back in time(Messed up Git repository)
Pulling master back in time [message #787771] Wed, 01 February 2012 00:25 Go to next message
Peter Drake is currently offline Peter DrakeFriend
Messages: 17
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 09:37 Go to previous messageGo to next message
Christian Halstrick is currently offline Christian HalstrickFriend
Messages: 274
Registered: July 2009
Senior 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 22:22 Go to previous messageGo to next message
Peter Drake is currently offline Peter DrakeFriend
Messages: 17
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 08:54 Go to previous messageGo to next message
Manuel Doninger is currently offline Manuel DoningerFriend
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 14:05 Go to previous message
R Shapiro is currently offline R ShapiroFriend
Messages: 386
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: Thu Apr 25 12:40:00 GMT 2024

Powered by FUDForum. Page generated in 0.03695 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top