gitversion-controlweb2pyweb-frameworksgit-subrepo

How to version-control multiple, dependent projects in one directory (e.g. web2py, django)


I'd like to get some advices to best handle and version control projects, which exhibit the following structure:

From a parent project (shared among many projects), I need to get a given directory structure and files, i.e.

.
|-- modules/
|    |-- file_1_parent.py
|
|-- controllers/
     |-- file_2_parent.py

From this parent project, several children dependents are derived, which add files to the directories.

The situation then could look like the following (the name of the projects to which the files/directories belong are in parenthesis)

.
|-- modules/                  (parent project)
|    |-- file_1_parent.py     (parent project)
|    |-- file_1_child.py      (child project)
|
|-- controllers/              (parent project)
     |-- file_2_parent.py     (parent project)
     |-- file_2_child.py      (child project)

To be concrete, in my case the parent project is web2py/django project, from which I want to derive several subprojects.

The question is now,

I thought about the following approaches:


Solution

  • Just do ordinary merges, the only thing you have to remember is when/if you merge back work on the parent's files done on a child branch to delete the child-project-specific files and changes from the merge result. Git keeps things straight so long as you record what you're actually doing. git diff --diff-filter=A --name-only @ will show you all files added in-flight, e.g. anything brought in by a no-commit merge, so do a no-commit merge, fix up the results to include only the changes you want, commit that, done. Once you get a handle on what fixups need doing you can automate a lot of it, but it won't always be just delete every new file.