简体   繁体   English

合并/合并不同分支之间的更改时,如何解决pom.xml冲突?

[英]How to resolve pom.xml conflicts when downmerging/upmerging changes in between different branches?

Consider this example: Assume that I have a "develop" branch. 考虑以下示例:假设我有一个“开发”分支。 I create a new branch out of "develop" named "XYZ". 我从“开发”创建了一个名为“ XYZ”的新分支。 I will use "XYZ" branch for a developing a particular feature for a month. 我将使用“ XYZ”分支来开发特定功能一个月。

After a month, I want to merge the entire "XYZ" branch in "develop". 一个月后,我想将整个“ XYZ”分支合并到“开发”中。 However, I may end up with lot of conflicts in pom.xml files of both projects. 但是,两个项目的pom.xml文件最终可能会出现很多冲突。 What is the best way to manage this scenario? 管理这种情况的最佳方法是什么?

Note: My real problem consists of having multiple maven projects with "develop" and respective "XYZ" branches. 注意:我真正的问题包括拥有多个带有“ develop”和相应的“ XYZ”分支的Maven项目。 All the projects are interrelated. 所有项目都是相互关联的。 Different projects will publish a "release" jar at different time intervals. 不同的项目将在不同的时间间隔发布一个“发布” jar。 Everytime a jar is released, its version will be incremented by 1 in the pom.xml. 每次释放jar时,其pom.xml中的版本都会增加1。 Hence, I will have to deal with multiple pom.xml conflict resolutions when I decide to merge the 2 branches. 因此,当我决定合并这两个分支时,我将不得不处理多个pom.xml冲突解决方案。

Please suggest how I can tackle this problem. 请提出我如何解决这个问题。 Thanks! 谢谢!

The best way to manage it, quite simply, is to dont worry about it too much and presume that most of the merge conflicts will be non-conflicting. 简单地讲,管理它的最佳方法是不必过于担心它,并假定大多数合并冲突将是非冲突的。

The conflicting merges that come up - just handle these manually. 出现冲突的合并-只需手动处理即可。

Generally, the work you are doing on the feature branch shouldnt conflict too much with the work that is going on in the development branch. 通常,您在功能分支上所做的工作不应与开发分支中正在进行的工作有太多冲突。

By the way you should look at a branching model by Vincent Driessen. 顺便说一下,您应该查看Vincent Driessen的分支模型。

http://nvie.com/posts/a-successful-git-branching-model/ http://nvie.com/posts/a-successful-git-branching-model/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM