0

I am working on a project where i am splitting up the entire project into multiple modules which are then being individually developed. I do not want the developers of the individual modules to have access to any other modules or the entire project and all they can see is their module.How can i go doing this using the existing git systems such as github or bitbucket. Would each module be a repo and then a main repo which hooked into each of these repos to merge the data?

Jude Fernandes
  • 7,437
  • 11
  • 53
  • 90

1 Answers1

1
  • If you manage all the modules in different branches of the same repo, the developers can view all the branches, you can just set write permissions for different developers on different branches.

  • If you don’t want the developers view other modules which they are not work on, you should manage different modules into separate git repositories.

    Assume developerA works on moduleA (in a separate repoA), the way to manually merge repoA into the main repo as below:

    #In the main repo
    git remote add -f repoA <URL for repoA>
    git pull repoA master
    git add .
    git commit -am 'get change from repoA to main repo'
    git push origin master
    

    If you want to use hooks to merge the module repos into main repo, you should meet below conditions:

    1. Enable to use server side hooks. You can use post-push hook on each module repo. When changes pushed to remote repo, you can pull the changes to local main repo.
    2. You’d better to setup the remote repos on your own machine since if you use github, the server side hooks are not available for users.
    3. If you decide to use git hook, you should consider to resolve the merge conflicts automatically. If the merge conflicts are not resolved, the script for git hook will hang up or return errors.

    You can also use other ways to merge the module repos into the main repo, such as git subtree or git sumodule etc.

Marina Liu
  • 36,876
  • 5
  • 61
  • 74
  • Different modules into separate git repositories seems like the way to go, in my research i was also made aware of git sub-trees. Would that be helpful in a case where the project involves designing an admin dashboard for the backend using an MVC Framework so features are split up among developers who would be creating files that would not be limited to 1 folder but multiple ie, a view file, a controller a model, maybe some js – Jude Fernandes Oct 18 '17 at 04:50
  • Yeah, git subtree is also ok to merge the module repos into the main repo. And the general direction is split the modules into different repos for your situation. – Marina Liu Oct 18 '17 at 07:00