Skip to content

Commit

Permalink
Allow passing arguments to git rebase
Browse files Browse the repository at this point in the history
If non-option arguments are passed to `git forgit rebase`, pass them
through directly to `git rebase`, without launching the interactive
selector, just like we do for other forgit commands.
  • Loading branch information
carlfriedrich committed Feb 12, 2025
1 parent 934fe65 commit 6ca8f77
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions bin/git-forgit
Original file line number Diff line number Diff line change
Expand Up @@ -724,6 +724,7 @@ _forgit_cherry_pick_from_branch() {

_forgit_rebase() {
_forgit_inside_work_tree || return 1
_forgit_contains_non_flags "$@" && { git rebase "$@"; return $?; }
local opts graph target_commit prev_commit
graph=()
[[ $_forgit_log_graph_enable == true ]] && graph=(--graph)
Expand All @@ -737,13 +738,13 @@ _forgit_rebase() {
$FORGIT_REBASE_FZF_OPTS
"
target_commit=$(
git log "${graph[@]}" --color=always --format="$_forgit_log_format" "$@" |
git log "${graph[@]}" --color=always --format="$_forgit_log_format" |
_forgit_emojify |
FZF_DEFAULT_OPTS="$opts" fzf |
_forgit_extract_sha)
if [[ -n "$target_commit" ]]; then
prev_commit=$(_forgit_previous_commit "$target_commit")
git rebase -i "${_forgit_rebase_git_opts[@]}" "$prev_commit"
git rebase -i "$@" "${_forgit_rebase_git_opts[@]}" "$prev_commit"
fi
}

Expand Down

0 comments on commit 6ca8f77

Please # to comment.