diff --git a/git-flow-bugfix b/git-flow-bugfix index 720e86dc..e05dd273 100644 --- a/git-flow-bugfix +++ b/git-flow-bugfix @@ -627,7 +627,7 @@ cmd_co() { cmd_rebase() { OPTIONS_SPEC="\ -git flow bugfix rebase [-h] [-i] [-p] [] +git flow bugfix rebase [-h] [-i] [-p] [-F] [] Rebase on -- @@ -635,16 +635,19 @@ h,help! Show this help showcommands! Show git commands while executing them i,[no]interactive Do an interactive rebase p,[no]preserve-merges Preserve merges +F,[no]fetch Fetch from origin before performing local operation " local opts # Define flags DEFINE_boolean 'interactive' false 'do an interactive rebase' i DEFINE_boolean 'preserve-merges' false 'try to recreate merges' p + DEFINE_boolean 'fetch' false 'fetch from origin before performing local operation' F # Override defaults with values from config gitflow_override_flag_boolean "bugfix.rebase.interactive" "interactive" gitflow_override_flag_boolean "bugfix.rebase.preserve-merges" "preserve_merges" + gitflow_override_flag_boolean "bugfix.rebase.fetch" "fetch" # Parse arguments parse_args "$@" @@ -673,7 +676,14 @@ p,[no]preserve-merges Preserve merges if flag preserve_merges; then opts="$opts -p" fi - git_do rebase $opts "$BASE_BRANCH" + + if flag fetch; then + # Update local branches with remote branches + git_fetch_branch "$ORIGIN" "$BASE_BRANCH" + git_do rebase $opts "$ORIGIN/$BASE_BRANCH" + else + git_do rebase $opts "$BASE_BRANCH" + fi } avoid_accidental_cross_branch_action() { diff --git a/git-flow-feature b/git-flow-feature index 275f54bd..3f56aa42 100644 --- a/git-flow-feature +++ b/git-flow-feature @@ -627,7 +627,7 @@ cmd_co() { cmd_rebase() { OPTIONS_SPEC="\ -git flow feature rebase [-h] [-i] [-p] [] +git flow feature rebase [-h] [-i] [-p] [-F] [] Rebase on -- @@ -635,16 +635,19 @@ h,help! Show this help showcommands! Show git commands while executing them i,[no]interactive Do an interactive rebase p,[no]preserve-merges Preserve merges +F,[no]fetch Fetch from origin before performing local operation " local opts # Define flags DEFINE_boolean 'interactive' false 'do an interactive rebase' i DEFINE_boolean 'preserve-merges' false 'try to recreate merges' p + DEFINE_boolean 'fetch' false 'fetch from origin before performing local operation' F # Override defaults with values from config gitflow_override_flag_boolean "feature.rebase.interactive" "interactive" gitflow_override_flag_boolean "feature.rebase.preserve-merges" "preserve_merges" + gitflow_override_flag_boolean "feature.rebase.fetch" "fetch" # Parse arguments parse_args "$@" @@ -674,7 +677,14 @@ p,[no]preserve-merges Preserve merges if flag preserve_merges; then opts="$opts -p" fi - git_do rebase $opts "$BASE_BRANCH" + + if flag fetch; then + # Update local branches with remote branches + git_fetch_branch "$ORIGIN" "$BASE_BRANCH" + git_do rebase $opts "$ORIGIN/$BASE_BRANCH" + else + git_do rebase $opts "$BASE_BRANCH" + fi } avoid_accidental_cross_branch_action() { diff --git a/git-flow-hotfix b/git-flow-hotfix index f97ed44a..0193599b 100644 --- a/git-flow-hotfix +++ b/git-flow-hotfix @@ -281,7 +281,7 @@ showcommands! Show git commands while executing them cmd_rebase() { OPTIONS_SPEC="\ -git flow hotfix rebase [-h] [-i] [-p] [] +git flow hotfix rebase [-h] [-i] [-p] [-F] [] Rebase on -- @@ -289,16 +289,19 @@ h,help! Show this help showcommands! Show git commands while executing them i,[no]interactive Do an interactive rebase p,[no]preserve-merges Preserve merges +F,[no]fetch Fetch from origin before performing local operation " local opts # Define flags DEFINE_boolean 'interactive' false 'do an interactive rebase' i DEFINE_boolean 'preserve-merges' false 'try to recreate merges' p + DEFINE_boolean 'fetch' false 'fetch from origin before performing local operation' F # Override defaults with values from config gitflow_override_flag_boolean "hotfix.rebase.interactive" "interactive" gitflow_override_flag_boolean "hotfix.rebase.preserve-merges" "preserve_merges" + gitflow_override_flag_boolean "hotfix.rebase.fetch" "fetch" # Parse arguments parse_args "$@" @@ -326,7 +329,14 @@ p,[no]preserve-merges Preserve merges if flag preserve_merges; then opts="$opts -p" fi - git_do rebase $opts "$BASE_BRANCH" + + if flag fetch; then + # Update local branches with remote branches + git_fetch_branch "$ORIGIN" "$BASE_BRANCH" + git_do rebase $opts "$ORIGIN/$BASE_BRANCH" + else + git_do rebase $opts "$BASE_BRANCH" + fi } cmd_track() { diff --git a/git-flow-release b/git-flow-release index e9c542da..e000d109 100644 --- a/git-flow-release +++ b/git-flow-release @@ -976,7 +976,7 @@ showcommands! Show git commands while executing them cmd_rebase() { OPTIONS_SPEC="\ -git flow release rebase [-h] [-i] [-p] [] +git flow release rebase [-h] [-i] [-p] [-F] [] Rebase on -- @@ -990,10 +990,12 @@ p,[no]preserve-merges Preserve merges # Define flags DEFINE_boolean 'interactive' false 'do an interactive rebase' i DEFINE_boolean 'preserve-merges' false 'try to recreate merges' p + DEFINE_boolean 'fetch' false 'fetch from origin before performing local operation' F # Override defaults with values from config gitflow_override_flag_boolean "release.rebase.interactive" "interactive" gitflow_override_flag_boolean "release.rebase.preserve-merges" "preserve_merges" + gitflow_override_flag_boolean "release.rebase.fetch" "fetch" # Parse arguments parse_args "$@" @@ -1021,7 +1023,14 @@ p,[no]preserve-merges Preserve merges if flag preserve_merges; then opts="$opts -p" fi - git_do rebase $opts "$BASE_BRANCH" + + if flag fetch; then + # Update local branches with remote branches + git_fetch_branch "$ORIGIN" "$BASE_BRANCH" + git_do rebase $opts "$ORIGIN/$BASE_BRANCH" + else + git_do rebase $opts "$BASE_BRANCH" + fi } cmd_delete() { diff --git a/git-flow-support b/git-flow-support index 7957c196..77729851 100644 --- a/git-flow-support +++ b/git-flow-support @@ -202,7 +202,7 @@ F,[no]fetch Fetch from origin before performing finish cmd_rebase() { OPTIONS_SPEC="\ -git flow support rebase [-h] [-i] [-p] [] +git flow support rebase [-h] [-i] [-p] [-F] [] Rebase on -- @@ -210,16 +210,19 @@ h,help! Show this help showcommands! Show git commands while executing them i,[no]interactive Do an interactive rebase p,[no]preserve-merges Preserve merges +F,[no]fetch Fetch from origin before performing local operation " local opts # Define flags DEFINE_boolean 'interactive' false 'do an interactive rebase' i DEFINE_boolean 'preserve-merges' false 'try to recreate merges' p + DEFINE_boolean 'fetch' false 'fetch from origin before performing local operation' F # Override defaults with values from config gitflow_override_flag_boolean "support.rebase.interactive" "interactive" gitflow_override_flag_boolean "support.rebase.preserve-merges" "preserve_merges" + gitflow_override_flag_boolean "support.rebase.fetch" "fetch" # Parse arguments parse_args "$@" @@ -247,5 +250,12 @@ p,[no]preserve-merges Preserve merges if flag preserve_merges; then opts="$opts -p" fi - git_do rebase $opts "$BASE_BRANCH" + + # Update local branches with remote branches + if flag fetch; then + git_fetch_branch "$ORIGIN" "$BASE_BRANCH" + git_do rebase $opts "$ORIGIN/$BASE_BRANCH" + else + git_do rebase $opts "$BASE_BRANCH" + fi }