@@ -167,6 +167,17 @@ public class GitFlowReleaseFinishMojo extends AbstractGitFlowMojo {
167167 @ Parameter (property = "skipReleaseMergeProdBranch" , defaultValue = "false" )
168168 private boolean skipReleaseMergeProdBranch = false ;
169169
170+ /**
171+ * Controls which branch is merged to develop branch. If set to
172+ * <code>true</code> then release branch will be merged to develop. If set to
173+ * <code>false</code> and tag is present ({@link #skipTag} is set to
174+ * <code>false</code>) then tag will be merged. If there is no tag then
175+ * production branch will be merged to develop.
176+ *
177+ */
178+ @ Parameter (property = "noBackMerge" , defaultValue = "false" )
179+ private boolean noBackMerge = false ;
180+
170181 /** {@inheritDoc} */
171182 @ Override
172183 public void execute () throws MojoExecutionException , MojoFailureException {
@@ -271,12 +282,10 @@ public void execute() throws MojoExecutionException, MojoFailureException {
271282 // get current project version from pom
272283 final String currentVersion = getCurrentProjectVersion ();
273284
285+ final String tagVersion = (tychoBuild || useSnapshotInRelease ) && ArtifactUtils .isSnapshot (currentVersion )
286+ ? currentVersion .replace ("-" + Artifact .SNAPSHOT_VERSION , "" )
287+ : currentVersion ;
274288 if (!skipTag ) {
275- String tagVersion = currentVersion ;
276- if ((tychoBuild || useSnapshotInRelease ) && ArtifactUtils .isSnapshot (currentVersion )) {
277- tagVersion = currentVersion .replace ("-" + Artifact .SNAPSHOT_VERSION , "" );
278- }
279-
280289 messageProperties .put ("version" , tagVersion );
281290
282291 // git tag -a ...
@@ -303,8 +312,15 @@ public void execute() throws MojoExecutionException, MojoFailureException {
303312 gitCommit (commitMessages .getUpdateDevToAvoidConflictsMessage ());
304313 }
305314
306- // merge branch master into develop
307- gitMerge (releaseBranch , releaseRebase , releaseMergeNoFF , false ,
315+ final String refToMerge ;
316+ if (noBackMerge ) {
317+ refToMerge = releaseBranch ;
318+ } else if (!skipTag ) {
319+ refToMerge = gitFlowConfig .getVersionTagPrefix () + tagVersion ;
320+ } else {
321+ refToMerge = gitFlowConfig .getProductionBranch ();
322+ }
323+ gitMerge (refToMerge , releaseRebase , releaseMergeNoFF , false ,
308324 commitMessages .getReleaseFinishDevMergeMessage (), messageProperties );
309325
310326 if (commitDevelopmentVersionAtStart && useSnapshotInRelease ) {
0 commit comments