是否可以使用 JGit 捆绑存储库?
我正在尝试执行与此 git 命令等效的操作:
git --git-dir=path/to/my/local/repo bundle create path/to/backup.bundle --all
是否可以使用 JGit 捆绑存储库?
我正在尝试执行与此 git 命令等效的操作:
git --git-dir=path/to/my/local/repo bundle create path/to/backup.bundle --all
public class BundleWriter extends Object
创建一个 Git 捆绑文件,用于将运动鞋网传输到另一个系统。
这是一个(未经测试的)示例:
Repository repo = new FileRepositoryBuilder()
.setGitDir(new File("path/to/my/local/repo/.git"))
.build();
BundleWriter bundle = new BundleWriter(repo);
for (Ref ref : repo.getRefDatabase().getRefs()) {
bundle.include(ref);
}
bundle.writeBundle(
new NullProgressMonitor(),
new FileOutputStream("path/to/backup.bundle"));