के साथ एक फ़ाइल के लिए लूपिंग पर लूपिंग, मैं एक रिपोज़ को जोड़ने और जोड़ने, कम करने और फ़ाइलों के लिए प्रतिबद्ध संदेशों को लूप करने के मामले में jGit फ़ाइल की मूल बातें के साथ पकड़ने में कामयाब रहा हूं।jgit
File gitDir = new File("/Users/myname/Sites/helloworld/.git");
RepositoryBuilder builder = new RepositoryBuilder();
Repository repository;
repository = builder.setGitDir(gitDir).readEnvironment()
.findGitDir().build();
Git git = new Git(repository);
RevWalk walk = new RevWalk(repository);
RevCommit commit = null;
// Add all files
// AddCommand add = git.add();
// add.addFilepattern(".").call();
// Commit them
// CommitCommand commit = git.commit();
// commit.setMessage("Commiting from java").call();
Iterable<RevCommit> logs = git.log().call();
Iterator<RevCommit> i = logs.iterator();
while (i.hasNext()) {
commit = walk.parseCommit(i.next());
System.out.println(commit.getFullMessage());
}
क्या मैं आगे क्या करना चाहते हैं एक एकल फाइल के लिए सभी प्रतिबद्ध संदेश मिलता है और फिर वापस समय में एक विशिष्ट संदर्भ/बात करने के लिए एकल फाइल वापस लौटने में सक्षम हो करने में सक्षम हो सकता है।
धन्यवाद, यह वास्तव में मेरी मदद करता है। +1 – Dylan