How to do equivalent of "git-reset --hard" and "git revert HEAD" using jgit?

From: Farrukh Najmi <hidden>
Date: 2016-06-15 22:45:39

I need some guidance on how use jgit to implement the following methods:


     /**
      * Rolls back all uncommitted changes so Index and worspace are 
rolled to committed state in HEAD version.
      * Functionally equivalent to "git reset --hard HEAD"
      *
      */
     public void rollback() {
     }

     /**
      * Undoes the last commit.
      * Functionally equivalent to "git revert HEAD"
      *
      * @param versionNameToRevertTo Version of Commit to revert to
      */
     public void revert(String versionNameToRevertTo) {
     }

It seems that I will have to walk the Tree and check status of each file 
to decide what to do with it. The TreeWalk api is not obvious from the 
javadoc.


TIA for any guidance you can provide.

-- 
Regards,
Farrukh Najmi

Web: http://www.wellfleetsoftware.com
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help