I have a github repository named "foo" (or rather "myusername/foo"). Now suppose I want to create a repository named "bar", which uses the code in foo; I could just make a copy of the files, but I don't want to need to pull updates - I want to always see only whatever's in the "foo" repository right now; and not to have commits of "updates from foo". I believe I've noticed some repositories in which subfolders are actually separate repositories; and I know git supports sub-repositories or some such thing. So, can I perform such a "repository mount"? If so, how?
Bonus points if I can have the "mount" at a certain version, or a certain branch, rather than the master
Beside the submodules and subtree, depending on your specific needs, you may also want to just have another repository without any logic and management.
In such case, you could place another repository in a subdirectory and add that subdirectory to the .gitignore
file.
E.g.
RepositoryA/
- .gitignore (first option)
- SomeDir/
- .gitignore (second option)
- RepositoryB/
.gitignore (first option)
Add one of these:
SomeDir/RepositoryB/
**/RepositoryB/
.gitignore (second option)
Add this:
RepositoryB/
This way, as I said, does not add any logic/management. It just lets you to use any revision from both repositories without any collision.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With