Git merge / cherry problem

I use git for a large old project that has two branches - v1.0 and v2.0. The source for each branch is very different in their places, identical in others. When I fix bugs in the v1.0 branch, I have to add them to the v2.0 branch with git cherry-pick , since git merge 1.0 will basically destroy large parts of the v2.0 source.

However, the new version settled on version 1.0, and using git cherry-pick to copy patches to the v2.0 branch is cumbersome. I would prefer to somehow tell git that when I do git merge from 1.0 → 2.0 to merge only from a certain point in the commit history 1.0 (i.e. when a new development is stopped). Is it possible? This would allow me to make several corrections for the v1.0 source and merge the changes in v2.0 at a time instead of using several cherry picks.

+4
source share
1 answer

From branch 2.0

 git merge --strategy=ours v1.0 

I myself have not tested it, so first try something unimportant, but from the documents this is exactly what you need.

From the documentation:

This allows any number of heads, but the resulting merge tree always refers to the current branch branch, in fact ignoring everything changes from all other branches. It is intended to replace the replacement of the old history of the development of side branches. Note that this is different from the -Xours option to a recursive merge strategy.

+3
source

All Articles