且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何使用 composer 安装部分 git 存储库?

更新时间:2023-11-16 23:36:04

给出"有没有办法只克隆一个 git 存储库的子目录?""No" ,并且作曲家将需要子目录签出功能来满足所需的功能,那么我建议作曲家可以做的***的事情是签出整个内容,然后删除您不想要的内容.

Given the answer to "Is there any way to clone a git repository's sub-directory only?" Is "No" , and sub directory checkout functionality would be required by composer to satisfy the desired functionality, then I would suggest the best composer could do was checkout the whole thing and then delete what you didnt want.

简而言之:不可能.

更长的答案:是 git 可以执行 sparse checkout 所以理论上作曲家有朝一日可以支持该功能.您可以使用 autoload 字段仅加载您想要的代码部分(即,不加载整个库).

The longer answer: is that git can do a sparse checkout so in theory composer could someday support that feature. You can use the autoload field to only load the section of code you want (ie, not load the whole lib).