提交的时间戳可以使用CommitCommand. 请注意,名称、电子邮件和时间戳必须与PersonIdent对象一起指定。
例如:
Date date = ...
PersonIdent defaultCommitter = new PersonIdent(git.getRepository());
PersonIdent committer = new PersonIdent(defaultCommitter, date);
git.commit().setMessage("Commit with time").setCommitter(committer).call();
Run Code Online (Sandbox Code Playgroud)
defaultCommitter在 git config 中定义的保留名称和电子邮件,时间戳是当前系统时间。使用第二个PersonIdent构造函数,名称和电子邮件取自 ,defaultCommitter时间戳被覆盖date。
| 归档时间: |
|
| 查看次数: |
503 次 |
| 最近记录: |