Skip to content
This repository has been archived by the owner on Jun 19, 2023. It is now read-only.

Adding fetch argument to the rebase command. #383

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions git-flow-bugfix
Original file line number Diff line number Diff line change
Expand Up @@ -627,24 +627,27 @@ cmd_co() {

cmd_rebase() {
OPTIONS_SPEC="\
git flow bugfix rebase [-h] [-i] [-p] [<name|nameprefix>]
git flow bugfix rebase [-h] [-i] [-p] [-F] [<name|nameprefix>]

Rebase <name> on <base_branch>
--
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 "$@"
Expand Down Expand Up @@ -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() {
Expand Down
14 changes: 12 additions & 2 deletions git-flow-feature
Original file line number Diff line number Diff line change
Expand Up @@ -627,24 +627,27 @@ cmd_co() {

cmd_rebase() {
OPTIONS_SPEC="\
git flow feature rebase [-h] [-i] [-p] [<name|nameprefix>]
git flow feature rebase [-h] [-i] [-p] [-F] [<name|nameprefix>]

Rebase <name> on <base_branch>
--
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 "$@"
Expand Down Expand Up @@ -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() {
Expand Down
14 changes: 12 additions & 2 deletions git-flow-hotfix
Original file line number Diff line number Diff line change
Expand Up @@ -281,24 +281,27 @@ showcommands! Show git commands while executing them

cmd_rebase() {
OPTIONS_SPEC="\
git flow hotfix rebase [-h] [-i] [-p] [<name|nameprefix>]
git flow hotfix rebase [-h] [-i] [-p] [-F] [<name|nameprefix>]

Rebase <name> on <base_branch>
--
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 "$@"
Expand Down Expand Up @@ -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() {
Expand Down
13 changes: 11 additions & 2 deletions git-flow-release
Original file line number Diff line number Diff line change
Expand Up @@ -976,7 +976,7 @@ showcommands! Show git commands while executing them

cmd_rebase() {
OPTIONS_SPEC="\
git flow release rebase [-h] [-i] [-p] [<name|nameprefix>]
git flow release rebase [-h] [-i] [-p] [-F] [<name|nameprefix>]

Rebase <name> on <base_branch>
--
Expand All @@ -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 "$@"
Expand Down Expand Up @@ -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() {
Expand Down
14 changes: 12 additions & 2 deletions git-flow-support
Original file line number Diff line number Diff line change
Expand Up @@ -202,24 +202,27 @@ F,[no]fetch Fetch from origin before performing finish

cmd_rebase() {
OPTIONS_SPEC="\
git flow support rebase [-h] [-i] [-p] [<name|nameprefix>]
git flow support rebase [-h] [-i] [-p] [-F] [<name|nameprefix>]

Rebase <name> on <base_branch>
--
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 "$@"
Expand Down Expand Up @@ -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
}