Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git: How to share only selected folders and files from a repository to allow 2 teams to collaborate on it, but not share the whole code base?

Tags:

git

windows

They need to collaborate on one folder; they should not see the rest.

They would need to be able to merge their changes into the main code base and get updates from that folder.

This is all based on Windows OS with Atlassian Stash and Git on internal network.

like image 463
Rod Avatar asked Oct 22 '25 21:10

Rod


2 Answers

That would mean that one folder needs to be its own repo:

  • added as a submodule (tracking a branch) in the main Git repo
  • forked by the second team, for them to push to the fork and make PR or synchronize from the original folder git repo.
like image 87
VonC Avatar answered Oct 25 '25 12:10

VonC


I would suggest separating the subset into a sub-project, and use language-specific ways to deliver it during building of you main project. For example, if you use MS Visual Studio, you could turn it into library or module and use nuget to deliver it during build of your main project.

In my experience it appears to be much more convenient than using submodules, when it comes to merging.

Another reason to do that - and maybe even more important one - that the other team would be able to handle the project as a compilable and testable unit, instead of a pile of source files.

like image 35
max630 Avatar answered Oct 25 '25 12:10

max630