Git merge conflict only on version tag in pom.xml Git merge conflict only on version tag in pom.xml git git

Git merge conflict only on version tag in pom.xml


What I always do is change the version of the modules using the maven versions plugin, before merging from another branch (with a different version):

mvn versions:set -DnewVersion=1.1 -DgenerateBackupPoms=false

That'll change the version of all the current modules (parent and children) to the one you specify as the newVersion parameter. After changing the version, make a new commit (git commit...) and then do the merge. I've got all of this automated using a Jenkins task, but it shouldn't be difficult to implement it in other ways (e.g. sh script).


You probably have a few options. None of which are perfect :-/

1) you can use 'git merge -s ours', but you should only do that when you know you don't need the rest of the changes too.

2) You can also use git rerere, which helps resolve conflicts by memorizing what you did last time. You can enable its usage globally so it always "just works" by setting rerere.enabled. Or you can read the man page and do it by hand as well.


You could also use a custom merge driver, as in pom-merge-driver.Depending on your workflow you might want to merge pom as a normal file, except treating the project version differently: always take the merging branch version, or make an exception when merging to the develop branch...