Skip to content

Commit

Permalink
Release finish squash parameter
Browse files Browse the repository at this point in the history
Adding an optional (false by default) -S option to 'git flow release finish' to allow squashing
the commit
  • Loading branch information
mykehsd committed Apr 19, 2012
1 parent ab7fda2 commit 6fa8fed
Showing 1 changed file with 21 additions and 7 deletions.
28 changes: 21 additions & 7 deletions git-flow-release
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ PREFIX=$(git config --get gitflow.prefix.release)
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>"
}
Expand Down Expand Up @@ -193,6 +193,7 @@ cmd_finish() {
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
Expand Down Expand Up @@ -224,9 +225,15 @@ cmd_finish() {
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
Expand All @@ -253,9 +260,16 @@ cmd_finish() {

# 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
Expand Down

0 comments on commit 6fa8fed

Please sign in to comment.