1+ # $Id$
2+ # vim:et:ft=sh:sts=2:sw=2
13#
24# git-flow -- A collection of Git extensions to provide high-level
35# repository operations for Vincent Driessen's branching model.
911# https://github.com/petervanderdoes/gitflow
1012#
1113# Authors:
12- # Copyright 2012-2016 Peter van der Does. All rights reserved.
14+ # Copyright 2012-2017 Peter van der Does. All rights reserved.
1315#
1416# Original Author:
1517# Copyright 2010 Vincent Driessen. All rights reserved.
@@ -243,6 +245,7 @@ showcommands! Show git commands while executing them
243245F,[no]fetch Fetch from origin before performing finish
244246r,[no]rebase Rebase before merging
245247p,[no]preserve-merges Preserve merges while rebasing
248+ [no]push Push to origin after performing finish
246249k,[no]keep Keep branch after performing finish
247250keepremote! Keep the remote branch
248251keeplocal! Keep the local branch
@@ -256,6 +259,7 @@ no-ff! Never fast-forward during the merge
256259 DEFINE_boolean ' fetch' false " fetch from $ORIGIN before performing finish" F
257260 DEFINE_boolean ' rebase' false " rebase before merging" r
258261 DEFINE_boolean ' preserve-merges' false ' try to recreate merges while rebasing' p
262+ DEFINE_boolean ' push' false " push to $ORIGIN after performing finish"
259263 DEFINE_boolean ' keep' false " keep branch after performing finish" k
260264 DEFINE_boolean ' keepremote' false " keep the remote branch"
261265 DEFINE_boolean ' keeplocal' false " keep the local branch"
@@ -268,6 +272,7 @@ no-ff! Never fast-forward during the merge
268272 gitflow_override_flag_boolean " bugfix.finish.fetch" " fetch"
269273 gitflow_override_flag_boolean " bugfix.finish.rebase" " rebase"
270274 gitflow_override_flag_boolean " bugfix.finish.preserve-merges" " preserve_merges"
275+ gitflow_override_flag_boolean " bugfix.finish.push" " push"
271276 gitflow_override_flag_boolean " bugfix.finish.keep" " keep"
272277 gitflow_override_flag_boolean " bugfix.finish.keepremote" " keepremote"
273278 gitflow_override_flag_boolean " bugfix.finish.keeplocal" " keeplocal"
@@ -464,6 +469,10 @@ helper_finish_cleanup() {
464469 fi
465470 fi
466471
472+ if flag push; then
473+ git_do push " $ORIGIN " " $BASE_BRANCH " || die " Could not push branch '$BASE_BRANCH ' to remote '$ORIGIN '."
474+ fi
475+
467476 echo
468477 echo " Summary of actions:"
469478 echo " - The bugfix branch '$BRANCH ' was merged into '$BASE_BRANCH '"
@@ -650,7 +659,9 @@ p,[no]preserve-merges Preserve merges
650659 BASE_BRANCH=${BASE_BRANCH:- $DEVELOP_BRANCH }
651660
652661 warn " Will try to rebase '$NAME ' which is based on '$BASE_BRANCH '..."
653- require_clean_working_tree
662+ if ! git_config_bool_exists " rebase.autostash" ; then
663+ require_clean_working_tree
664+ fi
654665 require_branch " $BRANCH "
655666
656667 git_local_branch_exists " $BASE_BRANCH " || die " The base '$BASE_BRANCH ' doesn't exists locally or is not a branch. Can't rebase the bugfix branch '$BRANCH '."
@@ -794,13 +805,13 @@ r,[no]remote Delete remote branch
794805 if git_is_branch_merged_into " $BRANCH " " $BASE_BRANCH " ; then
795806 git_do branch -d " $BRANCH " || die " Could not delete the $BRANCH ."
796807 if flag remote; then
797- git_do push "$ORIGIN" :"$ BRANCH" || die "Could not delete the remote $BRANCH in $ORIGIN. "
808+ git_remote_branch_delete " $ BRANCH"
798809 fi
799810 else
800811 if flag force; then
801812 git_do branch -D " $BRANCH " || die " Could not delete the $BRANCH ."
802813 if flag remote; then
803- git_do push "$ORIGIN" :"$ BRANCH" || die "Could not delete the remote $BRANCH in $ORIGIN. "
814+ git_remote_branch_delete " $ BRANCH"
804815 fi
805816 else
806817 die " bugfix branch '$BRANCH ' has been not been merged yet. Use -f to force the deletion."
@@ -817,3 +828,15 @@ r,[no]remote Delete remote branch
817828 echo " - You are now on branch '$( git_current_branch) '"
818829 echo
819830}
831+
832+ cmd_rename () {
833+ OPTIONS_SPEC=" \
834+ git flow bugfix rename <new_name> [<new_name>]
835+
836+ Rename a given bugfix branch
837+ --
838+ h,help! Show this help
839+ showcommands! Show git commands while executing them
840+ "
841+ gitflow_rename_branch " $@ "
842+ }
0 commit comments