使用Git,我想在我的项目中包含一些常见的JS / CSS库和/或实用程序方法 (即来自另一个存储库的特定文件),并且希望它们始终保持最新状态。我不想要整个远程存储库。如果我能够使用“本地副本”编辑远程文件并将更改推送回服务器,那就更好了。
一个相似的例子是,在ASP.NET中,我可以通过引用“远程”其他库的.dll文件(而不是“本地复制”)来实现这一点,这样无论何时重新编译外部库,我的项目都指向最新版本。
示例场景:
我的项目是...MyProject,我只需要来自外部存储库ExternalLibrary和External2的几个文件。我不想在其他地方克隆每个存储库并将文件复制粘贴到我的存储库中。如果我改进了
``` MyProject/ ├── index.html ├── scripts/ │ ├── mycode.js │ ├── otherplugin.js │ ├── common1.js <-- 来自ExternalLibrary │ └── plugin2.js <-- 来自ExternalLibrary └── styles/ ├── mystyle.css └── common.css <-- 来自External2
ExternalLibrary/ ├── common1.js ├── plugin1.js ├── plugin2.js └── bunchofothercrap...
External2/ ├── common.css └── bunchofothercrap... ```
一个相似的例子是,在ASP.NET中,我可以通过引用“远程”其他库的.dll文件(而不是“本地复制”)来实现这一点,这样无论何时重新编译外部库,我的项目都指向最新版本。
示例场景:
我的项目是...MyProject,我只需要来自外部存储库ExternalLibrary和External2的几个文件。我不想在其他地方克隆每个存储库并将文件复制粘贴到我的存储库中。如果我改进了
MyProject/scripts/common1.js
,我想将其推送回ExternalLibrary。``` MyProject/ ├── index.html ├── scripts/ │ ├── mycode.js │ ├── otherplugin.js │ ├── common1.js <-- 来自ExternalLibrary │ └── plugin2.js <-- 来自ExternalLibrary └── styles/ ├── mystyle.css └── common.css <-- 来自External2
ExternalLibrary/ ├── common1.js ├── plugin1.js ├── plugin2.js └── bunchofothercrap...
External2/ ├── common.css └── bunchofothercrap... ```
相关参考: