There is something not clear for me and this is how to prevent other people read my code. The thing is that I want people create their own branches but not to view the other's branches. If someone is responsible for networking, I don't want this guy to view graphics codes. S/He must be forced to work on his branch only.


1 Answer 1


You could let each individual create their section of the code in a submodule and then include all of the submodules into the main project. This would add a lot of complexity to the whole process though.

The git-submodule has this to say about them:

Submodules allow foreign repositories to be embedded within a dedicated subdirectory of the source tree, always pointed at a particular commit.

You create a submodule just as you would a normal repo and include it in the main repo like so:

git submodule add <repository>

where <repository> is the url to the repo to include.

The main question is why do you need to enforce this level of isolation and what happens if one part of the project has a dependancy on another one?


As the questioner has indicated that they want to protect IP from third party espionage action I have the following suggestion:

In stead of extracting the code for each person into a separate repository tree have the main IP that you want to keep separate contained in a "black box" library and have the development of that take place on a private repository by trusted developers. The untrusted developers can then develop the code that consumes this library in a less restricted repository.

This approach would have the advantage of requiring fewer repositories which will hopefully ease the process of development somewhat.

  • I want to find some people to help my project. However, they will be in a place of the world I dont know and cannot go. I want to keep my intellectual property in safe because those will be stranges at the beginning. Jul 12, 2013 at 23:04
  • Hmm. I suppose the question you have to be asking there is what kind of impression does that give them? I understand there are needs to protect privacy. Is a contractual agreement not strong enough in this situation? I don't know. Another suggestion would be if there was only a certain piece of IP that you are really concerned about extract that into a separate tree to keep it away from prying eyes but have the remaining development take place in the main tree. I'm only thinking of the potential for headaches due to the complexity of the development process here.
    – Will
    Jul 12, 2013 at 23:10

Not the answer you're looking for? Browse other questions tagged or ask your own question.