With Git, I'd like to include some common JS/CSS library and/or utility methods (i.e. specific files from another repo) in my project, and I'd like it so they're always up-to-date. I don't really want the entire remote repository(s). Bonus if I can work on my "local copies" of the remote files and push the changes back up.
A somewhat parallel example: in ASP.NET, I would do this by referencing the ("remote") other libraries' .dll
files (without "copy local"), so that whenever I recompile the external libraries my project would already point to the newest versions.
Example Scenario
My project is...MyProject, and I just want a couple files from external repositories ExternalLibrary and External2. I'd prefer not to clone each repository somewhere else and copy-paste the files into my repo. If I make an improvement to MyProject/scripts/common1.js
, I'd like to push that back to ExternalLibrary.
- MyProject/
- index.html
- scripts/
- mycode.js
- otherplugin.js
- common1.js <-- from ExternalLibrary
- plugin2.js <-- from ExternalLibrary
- styles/
- mystyle.css
- common.css <-- from External2
- ExternalLibrary/
- common1.js
- plugin1.js
- plugin2.js
- bunchofothercrap...
- External2/
- common.css
- bunchofothercrap...
Related references:
- Git: how to work with multiple repositories?
- How to checkout only one file from git repository?
- Get file from other developer local GIT and add to main repository
- Can a git repository be created where branches are clones from other repositories?
- http://www.kernel.org/pub/software/scm/git/docs/gitworkflows.html