问题
Is it possible with git hosted on Bitbucket to have a directory inside a git repo to be a subrepo with own access rights?
I am currently working with subversion where this is the case and want to switch to GitHub.
How can I isolate small projects within a huge codebase in order to work with freelancers that only see and work on that particular code which lives in a directory of that project?
回答1:
It is best to work with submodules: your main project will have "references" (called gitlink, special entries in the index) to your other repos.
Those repos will be declared in your main project as submodules, but can be used independently by other developers.
Using git submodule add, you can reference a repo located in any Git repo hosting service you want: a BitBucket main repo can reference repos managed by GitHub.
That means that you main project can be private on BitBucket, while the dependencies (the submodules) are public repos on GitHub.
来源:https://stackoverflow.com/questions/29325641/how-to-isolate-projects-folders-with-git-that-are-part-of-a-large-project