Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to achieve the below with Git?

Problem statement

The entire codebase was accessible to everyone till now. Now I need to enforce people get code of only those modules which they will work on, for other modules they will get a library as in lib. Assuming we have two modules right now

thinkbot (HEAD)

-> assemblebot (tree/subdir)

 -> include

 -> source

 -> lib

 -> obj

-> vpl (tree/subdir)

 -> include

 -> source

 -> lib

 -> obj

-> include

-> source -> bin`

Now if someone is working on vpl module he will get include and source folder containing the code and from assemblebot module he will get a lib. So when he makes changes and compiles from HEAD things will work out from him.

Guys how do I implement this in Git ? Pointers on What to read ? Command snippets would be great ?

like image 377
Ankur Gupta Avatar asked Mar 02 '23 00:03

Ankur Gupta


1 Answers

At the moment, the only way I can think of is by using submodules. The two modules (assemblebot, vpl) would each be a submodule, and the rest of the tree would be in the super project.

This essentially means that the two modules would have to be in separate repositories, and then in the master repository you git submodule init git://foo.com/assemblebot.git.

I'm not sure that this is worth the effort overall. It's not one of git's strong points (in fact it's the only thing I think needs improvement).

Better support for partial checkouts is in the works (narrow and sparse clones).

Edit: Considering that vpl and assemblebot depend on include and source, perhaps it's better to have include and source as submodules of the vpl and assemblebot repositories. However, these aren't separate projects, and what git does is track project content. I don't see a reason why these modules should actually be separated. Maybe just tell the developers not to touch the other's code?

like image 149
sebnow Avatar answered Mar 05 '23 15:03

sebnow