aleksandr-m / gitflow-maven-plugin

The Git-Flow Maven Plugin supports various Git workflows, including GitFlow and GitHub Flow. This plugin runs Git and Maven commands from the command line.
https://aleksandr-m.github.io/gitflow-maven-plugin/
Apache License 2.0
493 stars 181 forks source link

POM Conflicts on feature-finish #238

Open bcluap opened 4 years ago

bcluap commented 4 years ago

First off, thanks so much for a great tool!

One challenge I am having is with merge conflicts on all POM files in a project (multi module) when I follow a fairly simple flow like this:

1) Start on develop branch with version 2.3.4-SNAPSHOT 2) gitflow:feature-start for feature FEAT-1, make some changes in the feature branch & commit them. Feature has POM version 2.3.4-FEAT-1-SNAPSHOT 3) Checkout develop branch and do a gitflow:release of 2.3.4. Develop now goes to 2.3.5-SNAPSHOT 4) gitflow:feature-finish of FEAT-1. Get conflicts e.g.

[ERROR] Auto-merging pom.xml
[ERROR] CONFLICT (content): Merge conflict in pom.xml
<<<<<<< HEAD
    <version>2.3.5-SNAPSHOT</version>
=======
    <version>2.3.4-FEAT-1-SNAPSHOT</version>
>>>>>>> feature/FEAT-1

Am I doing something wrong? My expectation would be that gitflow would automagically update the version in the FEAT-1 POMs before merging to develop branch so that there are no merge conflicts in the POMs? I'm sure its a common scenario for a feature to be finished after the develop branch has had some version changes?

Any guidance would be greatly appreciated.

bcluap commented 4 years ago

I would really appreciate some insight on this. Thanks.

aleksandr-m commented 4 years ago

gitflow would automagically update the version in the FEAT-1 POMs before merging to develop branch

Update it to what version? Develop? What if feature version is greater than develop one?

bcluap commented 4 years ago

I kind of assumed it would be to the current develop version as feature-finish is pretty much saying that you want to merge the feature into the current develop branch and whatever state/version it is in will be preserved. If you wanted it into a different version then I guess you would first set develop to that version before merging.

bcluap commented 4 years ago

Maybe have some option/flag to indicate that feature-finish must adopt/keep the develop branch version.

bcluap commented 4 years ago

I've added a PR to enable this by setting retainDevelopVersion=true

https://github.com/aleksandr-m/gitflow-maven-plugin/pull/239

NR-MC commented 4 years ago

Is this possible with release branches too? I am encountering the same issue where we have upgraded the release pom to include a CI build number (To ensure we don't build with old dependencies), and when we finish the release branch it causes the same conflict you're seeing here.