Between lands between submodules and branches?

I just walked around creating theme branches for my unfinished projects that Git manages. All of them are very self-sufficient in such a way that one topic branch is not directly related to another topic branch. However, all branches have a common point of view, the main branch, which is the core of the system, topic branches simply expand the possibilities in the main branch.

If I understand correctly, if I do something in the main branch, which affects (m) any branches of topics (say, change the API used to communicate between the kernel and individual functions) that do not apply to the theme, it is automatically installed, so that the branches can be fixed accordingly. Changes must be manually merged or selected cherry in other branches.

I understand that using submodules will achieve this. Submodules, however, lead to too much separation between the main project and potential project projects, mainly because the functions are not self-sustaining. They rely on the core.

So, what I'm looking for is a kind of method to say that certain files / directories are unique to a particular branch, everything else comes from the main branch. Having no better analogy, speaking in terms of Photoshop, I want Master to be a background layer, and each topic branch would be a partially transparent image layer on top of it with some unique content.

+1
source share
2 answers

This concept of “composition” or “configuration inheritance” is not supported in Git, as explained in the question “ Flexible vs static branching ”. Only merges allow you to “compose” the exact set of files that you want.

The submodule function will help you identify a consistent set of files that should have their own life cycle and be tagged at their own pace. This does not apply to your functions.

Your approach should remain “ based on the system where you design, tag and integrate the entire system. If something develops on the main branch, it should be a merge on the function branches.
If the functions include another set of files that are modified in the main branch, this merge will be trivial. If not, you can follow the mateusza suggestion using an intermediate branch to resolve conflicts and evaluate the result of such a merge, while maintaining the absence of a function branch.

+1
source

Suppose you have a branch and a bunch of branches: feature1, feature2, feature3 ...

$ git checkout feature1 $ git branch master-with-feature1 $ git checkout master-with-feature1 $ git merge master 

Each time you make any changes to master or feature1, you can check master-with-feature1 and combine them.

0
source

Source: https://habr.com/ru/post/1286482/


All Articles