Added -k option to keep (feature|hotfix|relase) branch when calling 'finish'.
diff --git a/git-flow-feature b/git-flow-feature
index 8c7cacd..a38b0cc 100644
--- a/git-flow-feature
+++ b/git-flow-feature
@@ -44,7 +44,7 @@
usage() {
echo "usage: git flow feature [list] [-v]"
echo " git flow feature start [-F] <name> [<base>]"
- echo " git flow feature finish [-rF] <name|nameprefix>"
+ echo " git flow feature finish [-rFk] <name|nameprefix>"
echo " git flow feature publish <name>"
echo " git flow feature track <name>"
echo " git flow feature diff [<name|nameprefix>]"
@@ -180,7 +180,7 @@
parse_cmdline "$@"
# read arguments into global variables
- NAME=$1
+ NAME=${!#}
BRANCH=$PREFIX$NAME
}
@@ -232,6 +232,7 @@
cmd_finish() {
DEFINE_boolean fetch false "fetch from $ORIGIN before performing finish" F
DEFINE_boolean rebase false 'rebase instead of merge' r
+ DEFINE_boolean keep false 'keep branch after performing finish' k
parse_args "$@"
expand_nameprefix_arg
@@ -343,13 +344,23 @@
if flag fetch; then
git push "$ORIGIN" ":refs/heads/$BRANCH"
fi
- git branch -D "$BRANCH"
+
+
+ if flag keep; then
+ echo "Keep this branch" > /dev/null
+ else
+ git branch -d "$BRANCH"
+ fi
echo
echo "Summary of actions:"
echo "- The feature branch '$BRANCH' was merged into '$DEVELOP_BRANCH'"
#echo "- Merge conflicts were resolved" # TODO: Add this line when it's supported
- echo "- Feature branch '$BRANCH' has been removed"
+ if flag keep; then
+ echo "- Feature branch '$BRANCH' has been kept"
+ else
+ echo "- Feature branch '$BRANCH' has been removed"
+ fi
echo "- You are now on branch '$DEVELOP_BRANCH'"
echo
}