Jevgeni,
I came across some code last week that may prove to be a useful reference for the git-based undo functionality you are working on for Forge.
The Aquillian OpenShift container adapter uses a temporary git repository to stage the project in order to push it to a separate remote location where the tests are run. What you might find useful about this plugin is the use of jgit and the synchronization of state from the current repository to the temporary repository.
Here's the main class involved:
Here's where it is invoked:
Perhaps it will provide some useful ideas.
-Dan
--
Dan Allen
Principal Software Engineer, Red Hat | Author of Seam in Action
Registered Linux User #231597