Easy, as you mention, first download jgit:
C:\> cd C:\Users\VonC\prog\git\
C:\Users\VonC\prog\git> git clone https://github.com/eclipse/jgit
C:\Users\VonC\prog\git> cd jgit
Then search for a test ('tst
') which involves "authordate
":
C:\Users\VonC\prog\git\jgit>grep -nRHIi authordate *|grep tst
org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CommitCommandTest.java:446: final Date authorDate = new Date(1349621117000L);
That means you can have a look at the org.eclipse.jgit.test.tst.org.eclipse/jgit/api.CommitCommandTest, function commitAmendWithoutAuthorShouldSetOriginalAuthorAndAuthorTime()
:
You will see how to specify an author and an author date:
final Date authorDate = new Date(1349621117000L);
PersonIdent firstAuthor = new PersonIdent(authorName, authorEmail,
authorDate, TimeZone.getTimeZone("UTC"));
git.commit().setMessage("initial commit").setAuthor(firstAuthor).call();
Note, as I mention here, the test classes are a good source of documentation/illustration for JGit.