Git workflow for different versions of the framework

We have the following setup: three applications that are similar to each other with common code extracted into the framework. Each application is managed in its own git repository and includes the framework as a submodule of git.

The problem is that applications are now being developed in parallel with the addition of new features to the infrastructure that other applications do not need to support immediately. We currently have different areas of the structure for all applications. One application uses the main branch of the framework because most of the time, new features were first introduced in this application.

Frame branches

  • master (using App A)
  • Appb
  • APPC

When a new function appeared in appB that needed changes in the structure, these changes were made to the appB branch. If these changes were later needed in Appendix A, the appB branch was merged with the wizard. This means that all changes to appB should have been merged into master.

This system worked, but had some drawbacks.

  • merging a function from one branch to another meant that we had to merge all the changes
  • it’s easy to lose information about what has already been merged or what will be merged when merging one branch into another
  • Noting the changes in the gap, it was done using commit messages, which made the last point even more important.

We are currently looking for a new workflow. I was thinking about having the following branches

  • master
  • APPA
  • Appb
  • APPC

So, for each application, there is one branch and a leading branch, which includes all the changes. When new functions are developed, it is necessary to create a functional branch, and then apply it both to the wizard and to all application branches that are needed immediately. Other applications may combine the function branch when they need the function later.

I see the following problems with this

  • How can I merge a function branch into several branches and only merge the changes that occurred in the branch. I know "git rebase on ...", but I'm not quite sure if I can use this command several times.
  • Should I use git cherry pick to combine functions in multiple branches? I would prefer not to do this because I can think that it will be susceptible to errors if you do not select all the changes made to the property branch.
  • How to track which function (branch) was applied to which application. Can I use the --no-merge branch or will it only work if the branches have the same ancestor?

I believe this is the best way to achieve this, or should I completely rethink my strategy?

+6
source share
1 answer

As explained in Git and Multiple Branches , there are two practical solutions when applying commits to multiple branches (this is what you would do with your Feature branches option):

  • merge (which should allow you to reuse this branch of the function, since it will track what has already been merged with a particular bank): rebase --interactive may be so that you can reorder the commits, first setting the ones you want to combine and then those that you are not yet ready to combine.
  • cherry-picking (and now supports a number of commits ), but I was always careful in choosing cherries .
0
source

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


All Articles