I have a code that I have to optimize. I would like to support a set of code versions (each version can be described as a set of some functions, optimizations) at the same time. In the end, I will decide which version is the best. I do not want to combine these versions with fewer versions. However, I would like to be able to make a (minor) modification to the (large) source file that can redirect versions, and I want this modification to be written across several (possibly all) versions. How can I achieve this with git?
For example, consider 3 versions: v1, v2, v3 and the source code source.cpp, which has a lot of code that is different from all versions, but the class A method aMethod () is identical. I would like to update this method and record the update only in v1 and v2 versions.
How can i do this?
If I change source.cpp, for example, in v1, than merge it into v2, a merge conflict will occur (since source.cpp is different in v1, v2). Is there a way to avoid conflict? If not, what is the best way to deal with a merge conflict in this case? By the way, I do not want to increase the detail of the code, so aMethod () will be placed in a dedicated file, because a lot of source code has already been written, and there will be too much overhead for this modification that I describe.
Thanks in advance,
Daniel
source share