@@ -138,27 +138,12 @@ public void execute() throws MojoExecutionException, MojoFailureException {
138138 mvnRun (preFeatureFinishGoals );
139139 }
140140
141- // git checkout develop
142- gitCheckout (gitFlowConfig .getDevelopmentBranch ());
141+ final String currentFeatureVersion = getCurrentProjectVersion ();
143142
144- if (featureSquash ) {
145- // git merge --squash feature/...
146- gitMergeSquash (featureBranchName );
147- gitCommit (featureBranchName );
148- } else {
149- // git merge --no-ff feature/...
150- gitMergeNoff (featureBranchName , commitMessages .getFeatureFinishDevMergeMessage (), null );
151- }
152-
153- // get current project version from pom
154- final String currentVersion = getCurrentProjectVersion ();
143+ final String featName = featureBranchName .replaceFirst (gitFlowConfig .getFeatureBranchPrefix (), "" );
155144
156- final String featName = featureBranchName
157- .replaceFirst (gitFlowConfig .getFeatureBranchPrefix (), "" );
158-
159- if (currentVersion .contains ("-" + featName )) {
160- final String version = currentVersion
161- .replaceFirst ("-" + featName , "" );
145+ if (currentFeatureVersion .contains ("-" + featName )) {
146+ final String version = currentFeatureVersion .replaceFirst ("-" + featName , "" );
162147
163148 // mvn versions:set -DnewVersion=... -DgenerateBackupPoms=false
164149 mvnSetVersions (version );
@@ -171,6 +156,18 @@ public void execute() throws MojoExecutionException, MojoFailureException {
171156 gitCommit (commitMessages .getFeatureFinishMessage (), properties );
172157 }
173158
159+ // git checkout develop
160+ gitCheckout (gitFlowConfig .getDevelopmentBranch ());
161+
162+ if (featureSquash ) {
163+ // git merge --squash feature/...
164+ gitMergeSquash (featureBranchName );
165+ gitCommit (featureBranchName );
166+ } else {
167+ // git merge --no-ff feature/...
168+ gitMergeNoff (featureBranchName , commitMessages .getFeatureFinishDevMergeMessage (), null );
169+ }
170+
174171 // maven goals after merge
175172 if (StringUtils .isNotBlank (postFeatureFinishGoals )) {
176173 mvnRun (postFeatureFinishGoals );
@@ -181,10 +178,24 @@ public void execute() throws MojoExecutionException, MojoFailureException {
181178 mvnCleanInstall ();
182179 }
183180
181+ if (keepBranch ) {
182+ gitCheckout (featureBranchName );
183+
184+ mvnSetVersions (currentFeatureVersion );
185+
186+ Map <String , String > properties = new HashMap <String , String >();
187+ properties .put ("version" , currentFeatureVersion );
188+ properties .put ("featureName" , featName );
189+
190+ gitCommit (commitMessages .getUpdateFeatureBackMessage (), properties );
191+ }
192+
184193 if (pushRemote ) {
185194 gitPush (gitFlowConfig .getDevelopmentBranch (), false );
186195
187- if (!keepBranch ) {
196+ if (keepBranch ) {
197+ gitPush (featureBranchName , false );
198+ } else {
188199 gitPushDelete (featureBranchName );
189200 }
190201 }
0 commit comments