Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EGit / JGit » Reset to specified commit
Reset to specified commit [message #1741455] Thu, 25 August 2016 09:50 Go to next message
Vlad Acretoaie is currently offline Vlad AcretoaieFriend
Messages: 93
Registered: April 2014
Member
Hi,

I'm using JGit to programmatically pull remote changes to a local repository. If the pull fails and throws an exception, I want to reset the local repository to the latest commit before the pull attempt.

However, the ResetCommand does not take a commit identifier as an argument, even though the Git reset command accepts a <commit> parameter. Is this a known limitation of the ResetCommand, or am I missing something?

Is there an alternative JGit command that I could use to the same effect?

Thanks in advance!

Vlad
Re: Reset to specified commit [message #1741764 is a reply to message #1741455] Mon, 29 August 2016 11:00 Go to previous messageGo to next message
Christian Halstrick is currently offline Christian HalstrickFriend
Messages: 240
Registered: July 2009
Senior Member
have you tried ResetCommand#setRef(myCommit.getName())... ?

Ciao
Chris
Re: Reset to specified commit [message #1741778 is a reply to message #1741764] Mon, 29 August 2016 13:16 Go to previous message
Vlad Acretoaie is currently offline Vlad AcretoaieFriend
Messages: 93
Registered: April 2014
Member
Hi Christian,

Thank you for your answer.

I eventually did use ResetCommand#setRef(myCommit.getName()), but it took me some time to realize this would work. The API documentation for the setRef method seems a bit laconic.

Cheers,
Vlad
Previous Topic:Working with Multiple Repositories
Next Topic:Egit diff --git whitespace
Goto Forum:
  


Current Time: Sat Jul 22 17:18:37 GMT 2017

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

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