Reputation: 4363
I've got a software written in JS that consists of three parts that share a considerable amount of code. I have decided to keep them all in one repo. However, in a typical setup of the whole the parts almost certainly will be split between different machines, which means I would like to have a convenient way to clone the desired part and the shared part in a manner as simple as possible.
A bonus would be the ability to edit the downloaded parts and push them to the remote repo (without having the complete repo downloaded), nevertheless it's not needed as much.
What would be the most convenient way to achieve this? It doesn't look like there's a simple command that'd help me out, so I guess I'll have to take some extra steps.
Upvotes: 1
Views: 80
Reputation: 29867
You could use sparse checkouts, however they are not really convenient to use. Also, this would still clone the history of the whole repo, but the working tree would be limited to a "view" of only certain files. See e.g. this blog article for an example.
The Git developers are aware of that usability problem and had temporarily added --filter=sparse:path=<path>
support to git clone --filter
that was introduced in Git 2.17, but that was removed again in Git 2.22. However, a new approach is currently being discussed to add a new sparse-checkout
command to overcome the usability issues.
Upvotes: 3