Reputation: 45390
If I have a Git repo on a directory say /app1
is it possible to create a sub-repo on a directory /app1/framework
, basically I want to keep the framework inside of the parent directory, but I want to be able to clone just the contents of framework
.
Upvotes: 1
Views: 183
Reputation: 20194
I assume you don't intend to add files in the subrepo also in the parent repo - that would probably be bad idea (although possible).
Yes, you can create repos under another repo, usually it makes sense to use them as submodules. Generally I find Pro Git book a complete yet friendly source.
In case that looks overwhelming, here's a short summary: Git Submodules Cheatsheet. The extra commands you'll use in practice:
git submodule add pathto/subrepo # to add/link a subrepo(app1/framework to parent one /app1, the first time
git submodule update [--init] # if parent repo is shared(clone), where someone else added a submodule [--init: first time after the clone]
git commit # an extra commit on parent repo to record the changes in the subrepo
Upvotes: 2