Skip to content
This repository
Browse code

Release finish squash parameter

Adding an optional (false by default) -S option to 'git flow release finish' to allow squashing
the commit
  • Loading branch information...
commit 6fa8fed23e2781767b8d3e8ab7e2b3f30876c7c7 1 parent ab7fda2
Myke Hines authored April 19, 2012

Showing 1 changed file with 21 additions and 7 deletions. Show diff stats Hide diff stats

  1. 28  git-flow-release
28  git-flow-release
@@ -45,7 +45,7 @@ PREFIX=$(git config --get gitflow.prefix.release)
45 45
 usage() {
46 46
 	echo "usage: git flow release [list] [-v]"
47 47
 	echo "       git flow release start [-F] <version> [<base>]"
48  
-	echo "       git flow release finish [-Fsumpk] <version>"
  48
+	echo "       git flow release finish [-FsumpkS] <version>"
49 49
 	echo "       git flow release publish <name>"
50 50
 	echo "       git flow release track <name>"
51 51
 }
@@ -193,6 +193,7 @@ cmd_finish() {
193 193
 	DEFINE_boolean push false "push to $ORIGIN after performing finish" p
194 194
 	DEFINE_boolean keep false "keep branch after performing finish" k
195 195
 	DEFINE_boolean notag false "don't tag this release" n
  196
+    DEFINE_boolean squash false "squash release during merge" S
196 197
 
197 198
 	parse_args "$@"
198 199
 	require_version_arg
@@ -224,9 +225,15 @@ cmd_finish() {
224 225
 	if ! git_is_branch_merged_into "$BRANCH" "$MASTER_BRANCH"; then
225 226
 		git checkout "$MASTER_BRANCH" || \
226 227
 		  die "Could not check out $MASTER_BRANCH."
227  
-		git merge --no-ff "$BRANCH" || \
228  
-		  die "There were merge conflicts."
229  
-		  # TODO: What do we do now?
  228
+        if noflag squash; then
  229
+		    git merge --no-ff "$BRANCH" || \
  230
+		        die "There were merge conflicts."
  231
+		        # TODO: What do we do now?
  232
+        else
  233
+            git merge --squash "$BRANCH" || \
  234
+                die "There were merge conflicts."
  235
+            git commit
  236
+        fi
230 237
 	fi
231 238
 
232 239
 	if noflag notag; then
@@ -253,9 +260,16 @@ cmd_finish() {
253 260
 
254 261
 		# TODO: Actually, accounting for 'git describe' pays, so we should
255 262
 		# ideally git merge --no-ff $tagname here, instead!
256  
-		git merge --no-ff "$BRANCH" || \
257  
-		  die "There were merge conflicts."
258  
-		  # TODO: What do we do now?
  263
+        if noflag squash; then
  264
+		    git merge --no-ff "$BRANCH" || \
  265
+		        die "There were merge conflicts."
  266
+		        # TODO: What do we do now?
  267
+        else
  268
+		    git merge --squash "$BRANCH" || \
  269
+		        die "There were merge conflicts."
  270
+		        # TODO: What do we do now?
  271
+            git commit
  272
+        fi
259 273
 	fi
260 274
 
261 275
 	# delete branch

0 notes on commit 6fa8fed

Please sign in to comment.
Something went wrong with that request. Please try again.