Last active
October 7, 2015 20:27
-
-
Save mrw34/3220552 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.File; | |
import java.util.UUID; | |
import org.eclipse.jgit.api.Git; | |
public class TestUnstash { | |
public static void main(String[] args) throws Exception { | |
File directory = new File(System.getProperty("java.io.tmpdir"), UUID.randomUUID().toString()); | |
directory.mkdir(); | |
File.createTempFile("blank", null, directory); | |
Git git = new Git(Git.init().setDirectory(directory).call().getRepository()); | |
git.add().addFilepattern(".").call(); | |
git.commit().setMessage("").call(); | |
File subdirectory = new File(directory, "folder"); | |
subdirectory.mkdir(); | |
File.createTempFile("blank", null, subdirectory); | |
git.add().addFilepattern(".").call(); | |
git.stashCreate().call(); | |
git.stashApply().call(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment