Created
December 23, 2010 06:23
-
-
Save miya2000/752654 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
package ttt; | |
import java.io.File; | |
import org.eclipse.jgit.api.Git; | |
import org.eclipse.jgit.storage.file.FileRepository; | |
public class JGitTest { | |
public static void main(String[] args) throws Exception { | |
String testProjectPath = "C:\\tmp\\jgittest"; | |
File projectDir = new File(testProjectPath); | |
File gitDir = new File(projectDir, ".git"); | |
Git git = null; | |
if (!gitDir.exists()) { | |
git = Git.init().setDirectory(projectDir).call(); | |
} | |
else { | |
git = new Git(new FileRepository(gitDir)); | |
} | |
git.add().addFilepattern(".").call(); | |
git.commit().setMessage("aaaa").call(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment