Git development
 help / color / mirror / Atom feed
From: Farrukh Najmi <farrukh@wellfleetsoftware.com>
To: git@vger.kernel.org
Subject: How to do equivalent of "git-reset --hard" and "git revert HEAD" using jgit?
Date: Thu, 13 Nov 2008 12:43:16 -0500	[thread overview]
Message-ID: <491C6734.2060607@wellfleetsoftware.com> (raw)


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

                 reply	other threads:[~2008-11-13 17:44 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=491C6734.2060607@wellfleetsoftware.com \
    --to=farrukh@wellfleetsoftware.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox