Skip to content

Instantly share code, notes, and snippets.

@sawtell
Created January 14, 2016 15:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sawtell/e1df6a06a1d6ad8046d3 to your computer and use it in GitHub Desktop.
Save sawtell/e1df6a06a1d6ad8046d3 to your computer and use it in GitHub Desktop.
diff --git a/git-flow-feature b/git-flow-feature
index b993f8e..55198ad 100644
--- a/git-flow-feature
+++ b/git-flow-feature
@@ -46,7 +46,7 @@ init() {
usage() {
echo "usage: git flow feature [list] [-v]"
echo " git flow feature start [-F] <name> [<base>]"
- echo " git flow feature finish [-rFkDS] [<name|nameprefix>] [<base>]"
+ 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>]"
@@ -236,12 +236,10 @@ cmd_finish() {
DEFINE_boolean force_delete false "force delete feature branch after finish" D
DEFINE_boolean squash false "squash feature during merge" S
parse_args "$@"
- BASE=${2:-$DEVELOP_BRANCH}
expand_nameprefix_arg_or_current
# sanity checks
require_branch "$BRANCH"
- require_branch "$BASE"
# detect if we're restoring from a merge conflict
if [ -f "$DOT_GIT_DIR/.gitflow/MERGE_BASE" ]; then
@@ -254,7 +252,7 @@ cmd_finish() {
# TODO: git_is_clean_working_tree() should provide an alternative
# exit code for "unmerged changes in working tree", which we should
# actually be testing for here
- if git_is_clean_working_tree; then
+ if git_is_clean_working_tree; then
FINISH_BASE=$(cat "$DOT_GIT_DIR/.gitflow/MERGE_BASE")
# Since the working tree is now clean, either the user did a
@@ -290,31 +288,31 @@ cmd_finish() {
if has "$ORIGIN/$BRANCH" $(git_remote_branches); then
if flag fetch; then
git_do fetch -q "$ORIGIN" "$BRANCH"
- git_do fetch -q "$ORIGIN" "$BASE"
+ git_do fetch -q "$ORIGIN" "$DEVELOP_BRANCH"
fi
fi
if has "$ORIGIN/$BRANCH" $(git_remote_branches); then
require_branches_equal "$BRANCH" "$ORIGIN/$BRANCH"
fi
- if has "$ORIGIN/$BASE" $(git_remote_branches); then
- require_branches_equal "$BASE" "$ORIGIN/$BASE"
+ if has "$ORIGIN/$DEVELOP_BRANCH" $(git_remote_branches); then
+ require_branches_equal "$DEVELOP_BRANCH" "$ORIGIN/$DEVELOP_BRANCH"
fi
# 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_do checkout "$BASE"
- if [ "$(git rev-list -n2 "$BASE..$BRANCH" | wc -l)" -eq 1 ]; then
+ git_do checkout "$DEVELOP_BRANCH"
+ if [ "$(git rev-list -n2 "$DEVELOP_BRANCH..$BRANCH" | wc -l)" -eq 1 ]; then
git_do merge --ff "$BRANCH"
else
if noflag squash; then
@@ -328,9 +326,9 @@ cmd_finish() {
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 "$DOT_GIT_DIR/.gitflow"
- echo "$BASE" > "$DOT_GIT_DIR/.gitflow/MERGE_BASE"
+ echo "$DEVELOP_BRANCH" > "$DOT_GIT_DIR/.gitflow/MERGE_BASE"
echo
echo "There were merge conflicts. To resolve the merge conflict manually, use:"
echo " git mergetool"
@@ -367,14 +365,14 @@ helper_finish_cleanup() {
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
if flag keep; then
echo "- Feature branch '$BRANCH' is still available"
else
echo "- Feature branch '$BRANCH' has been removed"
fi
- echo "- You are now on branch '$BASE'"
+ echo "- You are now on branch '$DEVELOP_BRANCH'"
echo
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment