Release finish squash parameter
Adding an optional (false by default) -S option to 'git flow release finish' to allow squashing
the commit
diff --git a/git-flow-release b/git-flow-release
index bb39d52..67037d7 100644
--- a/git-flow-release
+++ b/git-flow-release
@@ -45,7 +45,7 @@
usage() {
echo "usage: git flow release [list] [-v]"
echo " git flow release start [-F] <version> [<base>]"
- echo " git flow release finish [-Fsumpk] <version>"
+ echo " git flow release finish [-FsumpkS] <version>"
echo " git flow release publish <name>"
echo " git flow release track <name>"
}
@@ -193,6 +193,7 @@
DEFINE_boolean push false "push to $ORIGIN after performing finish" p
DEFINE_boolean keep false "keep branch after performing finish" k
DEFINE_boolean notag false "don't tag this release" n
+ DEFINE_boolean squash false "squash release during merge" S
parse_args "$@"
require_version_arg
@@ -224,9 +225,15 @@
if ! git_is_branch_merged_into "$BRANCH" "$MASTER_BRANCH"; then
git checkout "$MASTER_BRANCH" || \
die "Could not check out $MASTER_BRANCH."
- git merge --no-ff "$BRANCH" || \
- die "There were merge conflicts."
- # TODO: What do we do now?
+ if noflag squash; then
+ git merge --no-ff "$BRANCH" || \
+ die "There were merge conflicts."
+ # TODO: What do we do now?
+ else
+ git merge --squash "$BRANCH" || \
+ die "There were merge conflicts."
+ git commit
+ fi
fi
if noflag notag; then
@@ -253,9 +260,16 @@
# TODO: Actually, accounting for 'git describe' pays, so we should
# ideally git merge --no-ff $tagname here, instead!
- git merge --no-ff "$BRANCH" || \
- die "There were merge conflicts."
- # TODO: What do we do now?
+ if noflag squash; then
+ git merge --no-ff "$BRANCH" || \
+ die "There were merge conflicts."
+ # TODO: What do we do now?
+ else
+ git merge --squash "$BRANCH" || \
+ die "There were merge conflicts."
+ # TODO: What do we do now?
+ git commit
+ fi
fi
# delete branch