1
+ # $Id$
2
+ # vim:et:ft=sh:sts=2:sw=2
1
3
#
2
4
# git-flow -- A collection of Git extensions to provide high-level
3
5
# repository operations for Vincent Driessen's branching model.
9
11
# http://github.com/petervanderdoes/gitflow
10
12
#
11
13
# Authors:
12
- # Copyright 2012-2016 Peter van der Does. All rights reserved.
14
+ # Copyright 2012-2017 Peter van der Does. All rights reserved.
13
15
#
14
16
# Original Author:
15
17
# Copyright 2010 Vincent Driessen. All rights reserved.
@@ -243,6 +245,7 @@ showcommands! Show git commands while executing them
243
245
F,[no]fetch Fetch from origin before performing finish
244
246
r,[no]rebase Rebase before merging
245
247
p,[no]preserve-merges Preserve merges while rebasing
248
+ [no]push Push to origin after performing finish
246
249
k,[no]keep Keep branch after performing finish
247
250
keepremote! Keep the remote branch
248
251
keeplocal! Keep the local branch
@@ -256,6 +259,7 @@ no-ff! Never fast-forward during the merge
256
259
DEFINE_boolean ' fetch' false " fetch from $ORIGIN before performing finish" F
257
260
DEFINE_boolean ' rebase' false " rebase before merging" r
258
261
DEFINE_boolean ' preserve-merges' false ' try to recreate merges while rebasing' p
262
+ DEFINE_boolean ' push' false " push to $ORIGIN after performing finish"
259
263
DEFINE_boolean ' keep' false " keep branch after performing finish" k
260
264
DEFINE_boolean ' keepremote' false " keep the remote branch"
261
265
DEFINE_boolean ' keeplocal' false " keep the local branch"
@@ -268,6 +272,7 @@ no-ff! Never fast-forward during the merge
268
272
gitflow_override_flag_boolean " bugfix.finish.fetch" " fetch"
269
273
gitflow_override_flag_boolean " bugfix.finish.rebase" " rebase"
270
274
gitflow_override_flag_boolean " bugfix.finish.preserve-merges" " preserve_merges"
275
+ gitflow_override_flag_boolean " bugfix.finish.push" " push"
271
276
gitflow_override_flag_boolean " bugfix.finish.keep" " keep"
272
277
gitflow_override_flag_boolean " bugfix.finish.keepremote" " keepremote"
273
278
gitflow_override_flag_boolean " bugfix.finish.keeplocal" " keeplocal"
@@ -464,6 +469,10 @@ helper_finish_cleanup() {
464
469
fi
465
470
fi
466
471
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
+
467
476
echo
468
477
echo " Summary of actions:"
469
478
echo " - The bugfix branch '$BRANCH ' was merged into '$BASE_BRANCH '"
@@ -650,7 +659,9 @@ p,[no]preserve-merges Preserve merges
650
659
BASE_BRANCH=${BASE_BRANCH:- $DEVELOP_BRANCH }
651
660
652
661
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
654
665
require_branch " $BRANCH "
655
666
656
667
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
794
805
if git_is_branch_merged_into " $BRANCH " " $BASE_BRANCH " ; then
795
806
git_do branch -d " $BRANCH " || die " Could not delete the $BRANCH ."
796
807
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"
798
809
fi
799
810
else
800
811
if flag force; then
801
812
git_do branch -D " $BRANCH " || die " Could not delete the $BRANCH ."
802
813
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"
804
815
fi
805
816
else
806
817
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
817
828
echo " - You are now on branch '$( git_current_branch) '"
818
829
echo
819
830
}
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