+-
如何在裸存储库中使用JGit暂存文件?
我读了 question and answer for staging files in a non-bare repository.但是,我正在使用一个裸存储库,我想要暂存文件.

我尝试使用test for DirCacheBuilder,但代码Repository.lockDirCache()或Repository.readDirCache()失败,因为这是一个裸存储库.

org.eclipse.jgit.errors.NoWorkTreeException: Bare Repository has neither a working tree, nor an index
at org.eclipse.jgit.lib.Repository.getIndexFile(Repository.java:993)
at org.eclipse.jgit.dircache.DirCache.read(DirCache.java:166)
at org.eclipse.jgit.lib.Repository.readDirCache(Repository.java:1017)

那么,我怎样才能使用JGit在裸存储库中暂存文件?这有可能吗?

最佳答案

how could I stage files in a bare repository using JGit?

你不会,因为错误说明:

Bare Repository has neither a working tree, nor an index

没有索引,意味着没有分期.

点击查看更多相关文章

转载注明原文:如何在裸存储库中使用JGit暂存文件? - 乐贴网