diff --git a/Documentation/git-pull.txt b/Documentation/git-pull.txt index e1da46876682e9..f440fcd23cea7c 100644 --- a/Documentation/git-pull.txt +++ b/Documentation/git-pull.txt @@ -101,13 +101,16 @@ include::merge-options.txt[] :git-pull: 1 ---rebase:: +--rebase[=interactive]:: Rebase the current branch on top of the upstream branch after fetching. If there is a remote-tracking branch corresponding to the upstream branch and the upstream branch was rebased since last fetched, the rebase uses that information to avoid rebasing non-local changes. + +The optional mode `interactive` tells Git to switch on rebase's interactive +mode. ++ See `branch..rebase` and `branch.autosetuprebase` in linkgit:git-config[1] if you want to make `git pull` always use `{litdd}rebase` instead of merging. diff --git a/git-pull.sh b/git-pull.sh index 8c1370f81bfa95..9a067301705e0a 100755 --- a/git-pull.sh +++ b/git-pull.sh @@ -43,6 +43,7 @@ log_arg= verbosity= progress= recurse_submodules= merge_args= curr_branch=$(git symbolic-ref -q HEAD) curr_branch_short="${curr_branch#refs/heads/}" +rebase_options= rebase=$(git config --bool branch.$curr_branch_short.rebase) dry_run= while : @@ -105,7 +106,12 @@ do -r|--r|--re|--reb|--reba|--rebas|--rebase) rebase=true ;; + --rebase=i|--rebase=interactive) + rebase_options=-i + rebase=true + ;; --no-r|--no-re|--no-reb|--no-reba|--no-rebas|--no-rebase) + rebase_options= rebase=false ;; --recurse-submodules) @@ -270,7 +276,7 @@ fi merge_name=$(git fmt-merge-msg $log_arg <"$GIT_DIR/FETCH_HEAD") || exit case "$rebase" in true) - eval="git-rebase $diffstat $strategy_args $merge_args" + eval="git-rebase $rebase_options $diffstat $strategy_args $merge_args" eval="$eval --onto $merge_head ${oldremoteref:-$merge_head}" ;; *)