How do I implement sparse checkout in JGit?

邮差的信 提交于 2019-12-01 12:52:01

问题


I need to pull the contents of a specific sub directory in a Github Repository and put it under my own directory. After much research, it seems sparse checkouts is the way to go. However, I am a little unsure, as to how to implement this using JGit.


回答1:


1) You cannot clone only part of a repo -- for example, a repo with lib and Tests but you want to clone only the lib portion.

2) You can use "git clone --depth DEPTH ..." to clone only DEPTH revisions back, but you still get the whole repo, just not all of the revisions. (There are other limitations, so please man git-clone first.)

3) You can perform git clone --bare ..., then checkout just the files that you need (the "sparse checkout" you speak of). (Alas, there are more steps to that method than these two...)

Note that in (3) you will still end up with all of the history from the origin repo unless you add the --depth DEPTH argument.



来源:https://stackoverflow.com/questions/14407461/how-do-i-implement-sparse-checkout-in-jgit

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!