How does Git manage multiple versions horizontally?

problem description

now there is such a requirement:
there is a software, there are several versions of this software, and there is little difference between these versions.
that is, most of the code in these versions is the same, and a small part of the code in
is different.

the point is:
has a problem with the public parts of these programs.
can I have a way to modify
only once, and
to make all versions change
but keep the original version different?

the platform version of the problem and what methods you have tried

(1) extraction of common parts is a big problem.

finally, I found that my needs are a little contradictory, but I still want to discuss it with you.

Thank you

Apr.05,2021

in the title, you said that it is difficult to extract the public part. It is estimated that the public part may have been changed in all projects, and the changes are unknown. The only feasible way in the short term is to use git cherry-pick to merge the changes into each branch and resolve the conflict manually.

in the long run, Feng_Yu has come up with the best theoretical solution to extract the public parts into a separate project. Then all other projects refer to this project in the form of SubModule (submodules).


git submodule


my less formal method is a quick way to cut the mess. For example, there are three versions of A B C

.
  1. choose any version, such as A, and pull three branches from A, A'B'C'
  2. .
  3. other (BMague C) compare with this A, package all the difference files of BMague C (archive + diff command)
  4. overwrite the difference files to B'C' and commit once
  5. Test whether the B'C' branch is normal,
  6. pull a branch from A base.

the public part will be changed to base , and the difference part will be changed to A'B'C'
attached: course with difference package


doesn't see a specific problem, but it seems that one core branch + several branches rebase is also feasible.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1bf9e46-54e0d.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1bf9e46-54e0d.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?