开发者

Git merge/cherry-pick issue

I am using git for a large legacy project which has two branches - v1.0 and v2.0. The source for each branch is very different in places, identical in others. Wh开发者_Go百科en I make a bug fixes to the v1.0 branch I have to add them to the v2.0 branch using git cherry-pick as a git merge 1.0 would basically trash large parts of the v2.0 source.

However, new development has stopped on v1.0 and using git cherry-pick to copy fixes to the v2.0 branch is cumbersome. I would prefer to somehow be able to tell git that when I do a git merge from 1.0 -> 2.0 to only merge starting from a specific point in the 1.0 commit history (i.e. when new development stopped). Is this possible? It would allow me to make multiple fixes to the v1.0 source and merge the changes into v2.0 in one hit instead of using multiple cherry-picks.


From 2.0 branch execute

git merge --strategy=ours v1.0

I didn't tested it myself so try it first on something not important, but from docs it is exactly what you need.

From documentation:

This resolves any number of heads, but the resulting tree of the merge is always that of the current branch head, effectively ignoring all changes from all other branches. It is meant to be used to supersede old development history of side branches. Note that this is different from the -Xours option to the recursive merge strategy.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜