Added an optional <base> argument to all start subactions.
The only exception to the rule is git-flow-support, which has an
explicitly required <base> argument (since we cannot deduce a sane default
name for base).
Furthermore, these <base> arguments are checked to refer to commits on:
- develop (for feature, release)
- master (for hotfix, support)
Removed any occurrences of optional <base> arguments in finish subactions.
The finishing target branches are clearly defined by the model. The <base>
argument will probably confuse users. If they want the power to merge
those feature branches into *other* branches then develop, for example,
they can still use the magical power of Git itself for that. Gitflow
should not provide such support.
diff --git a/git-flow-feature b/git-flow-feature
index 6cb635a..4cb5c52 100644
--- a/git-flow-feature
+++ b/git-flow-feature
@@ -17,7 +17,7 @@
usage() {
echo "usage: git flow feature [list] [-v]"
echo " git flow feature start [-Fv] <name> [<base>]"
- echo " git flow feature finish [-rsFv] <name|nameprefix> [<base>]"
+ echo " git flow feature finish [-rsFv] <name|nameprefix>"
echo " git flow feature publish <name>"
echo " git flow feature track <name>"
echo " git flow feature diff <name|nameprefix>"
@@ -148,7 +148,6 @@
# read arguments into global variables
NAME="$1"
- BASE="${2:-$DEVELOP_BRANCH}"
BRANCH=$PREFIX$NAME
}
@@ -156,6 +155,7 @@
DEFINE_boolean fetch false 'fetch from origin before performing local operation' F
DEFINE_boolean force false 'force creation of feature branch (ignores dirty working tree)' f
parse_args "$@"
+ BASE="${2:-$DEVELOP_BRANCH}"
require_name
# sanity checks
@@ -248,24 +248,22 @@
if has $ORIGIN/$BRANCH $REMOTE_BRANCHES; then
gitflow_require_branches_equal $BRANCH $ORIGIN/$BRANCH
fi
- if [ "$BASE" = "$DEVELOP_BRANCH" ]; then
- gitflow_require_branches_equal $DEVELOP_BRANCH $ORIGIN/$DEVELOP_BRANCH
- fi
+ gitflow_require_branches_equal $DEVELOP_BRANCH $ORIGIN/$DEVELOP_BRANCH
# if the user wants to rebase, do that first
if flag rebase; then
- if ! git flow feature rebase "$NAME" "$BASE"; then
+ if ! git flow feature rebase "$NAME" "$DEVELOP_BRANCH"; then
warn "Finish was aborted due to conflicts during rebase."
warn "Please finish the rebase manually now."
warn "When finished, re-run:"
- warn " git flow feature finish '$NAME' '$BASE'"
+ warn " git flow feature finish '$NAME' '$DEVELOP_BRANCH'"
exit 1
fi
fi
# merge into BASE
- git checkout $BASE
- if [ "$(git rev-list -n2 $BASE..$BRANCH | wc -l)" -eq 1 ]; then
+ git checkout $DEVELOP_BRANCH
+ if [ "$(git rev-list -n2 $DEVELOP_BRANCH..$BRANCH | wc -l)" -eq 1 ]; then
git merge --ff $BRANCH
else
git merge --no-ff $BRANCH
@@ -273,9 +271,9 @@
if [ $? -ne 0 ]; then
# oops.. we have a merge conflict!
- # write the given $BASE to a temporary file (we need it later)
+ # write the given $DEVELOP_BRANCH to a temporary file (we need it later)
mkdir -p "$GIT_DIR/.gitflow"
- echo "$BASE" > "$GIT_DIR/.gitflow/MERGE_BASE"
+ echo "$DEVELOP_BRANCH" > "$GIT_DIR/.gitflow/MERGE_BASE"
echo
echo "There were merge conflicts. To resolve the merge conflict manually, use:"
echo " git mergetool"
@@ -304,10 +302,10 @@
echo
echo "Summary of actions:"
- echo "- The feature branch '$BRANCH' was merged into '$BASE'"
+ 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"
- echo "- You are now on branch '$BASE'"
+ echo "- You are now on branch '$DEVELOP_BRANCH'"
echo
}
@@ -380,5 +378,5 @@
if flag interactive; then
OPTS="$OPTS -i"
fi
- git rebase $OPTS "$BASE"
+ git rebase $OPTS "$DEVELOP_BRANCH"
}