Combine a base project that is growing in child projects in git repository except git submodule or subtree merge methods
There are some child projects: “Project 1”, “project 2” and so on in the future.
Also, There is a project that named: “Base Project” and it’s foundation of other projects. “Base Project” is a content management system (CMS).
- How do I reconnect a moved git repository with it's original project in Egit?
- How to migrate gitorious to gitlab repositories
- git pull into a specific directory
- show all git log for several git projects
- Issues while creating repository?
- How do I clone a repo to a remote server using ssh
All projects have their own git repositories.
“Project 1” , “project 2” and others uses “Base Project” to develop and grow.
There are some methods in git like submodule or subtreemerge. but don’t seem to fit here.
“Base Project” not should be clone into a sub directory. It’s in root directory. It’s growing in “project 1” or “project 2″…
When I work in child projects, I have to be able to push “Base Project” changes separately to It’s own repository to fetch in other children.
What can I do?
One Solution collect form web for “Combine a base project that is growing in child projects in git repository except git submodule or subtree merge methods”
Subtree merge or submodules are for a component-based development: two different but coherent set of files combined together.
Each set of files is in its own directory, because they can be branched or labelled independently (submodules), or together (subtree merge, while keeping the ability to get back an history of their own).
Both are requiring a separate directory though.
But what you are describing (“
Base Project” is in root directory, growing in “
project 1” or “
project 2“) is about a system-based approach: all components merged into one large component: one large set of file which will always evolve together, as one unit.
So you can have one branch per project:
CMS-project2, and so on.
But if you need to report
projectx-specific modifications or CMS-specific modifications back to their original (and separate) repos, then make said specific changes in dedicated branches, and then combine those changes:
branchp1would be for changes affecting
branchc1would be for changes affecting
branch1would be the result of the merge from
(same thing for
You can then export those changes as patches:
The inconvenient is that Git won’t remember what has already been merged back to the original repos, but that would allow you to report the common history developed in your
CMS-projectx set of files back to your original
Note: if you don’t want to manage 2 extra branches, another solution is to:
- make sure each commit only include CMS modification OR project modification
- leave a commit message which helps to distinguish them (“
[CMS] my CMS modification comment...“, or “
[Project1] my project1 modification comment...“
- use the script
git-extract-patchesto export as patches only the right commits.