Skip to content

Commit

Permalink
Feature 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 feature finish' to allow squashing
the commit
  • Loading branch information
mykehsd committed Apr 19, 2012
1 parent 6fa8fed commit 75fbdd7
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions git-flow-feature
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ PREFIX=$(git config --get gitflow.prefix.feature)
usage() {
echo "usage: git flow feature [list] [-v]"
echo " git flow feature start [-F] <name> [<base>]"
echo " git flow feature finish [-rFkD] [<name|nameprefix>]"
echo " git flow feature finish [-rFkDS] [<name|nameprefix>]"
echo " git flow feature publish <name>"
echo " git flow feature track <name>"
echo " git flow feature diff [<name|nameprefix>]"
Expand Down Expand Up @@ -232,6 +232,7 @@ cmd_finish() {
DEFINE_boolean rebase false "rebase instead of merge" r
DEFINE_boolean keep false "keep branch after performing finish" k
DEFINE_boolean force_delete false "force delete feature branch after finish" D
DEFINE_boolean squash false "squash feature during merge" S
parse_args "$@"
expand_nameprefix_arg_or_current

Expand Down Expand Up @@ -312,7 +313,13 @@ cmd_finish() {
if [ "$(git rev-list -n2 "$DEVELOP_BRANCH..$BRANCH" | wc -l)" -eq 1 ]; then
git merge --ff "$BRANCH"
else
git merge --no-ff "$BRANCH"
if noflag squash; then
git merge --no-ff "$BRANCH"
else
git merge --squash "$BRANCH"
git commit
git merge "$BRANCH"
fi
fi

if [ $? -ne 0 ]; then
Expand Down Expand Up @@ -353,7 +360,7 @@ helper_finish_cleanup() {
git branch -d "$BRANCH"
fi
fi

t
echo
echo "Summary of actions:"
echo "- The feature branch '$BRANCH' was merged into '$DEVELOP_BRANCH'"
Expand Down

0 comments on commit 75fbdd7

Please sign in to comment.