Skip to main content



      Home
Home » Eclipse Projects » EGit / JGit » 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
Eclipse UserFriend
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
Eclipse UserFriend
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"
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
Eclipse UserFriend
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
Eclipse UserFriend
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
Eclipse UserFriend
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: Sat Jun 21 01:50:46 EDT 2025

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

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

Back to the top