From d4d4a910b326fb942c24b4f290d158c954c73162 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Fri, 21 Oct 2011 23:27:09 -0500 Subject: [PATCH] Teach 'git pull' to handle --rebase=interactive Signed-off-by: Johannes Schindelin --- Documentation/git-pull.txt | 5 ++++- git-pull.sh | 8 +++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/Documentation/git-pull.txt b/Documentation/git-pull.txt index 67fa5ee195..ce04b68d9a 100644 --- a/Documentation/git-pull.txt +++ b/Documentation/git-pull.txt @@ -102,13 +102,16 @@ include::merge-options.txt[] :git-pull: 1 -r:: ---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 `pull.rebase`, `branch..rebase` and `branch.autosetuprebase` in linkgit:git-config[1] if you want to make `git pull` always use `--rebase` instead of merging. diff --git a/git-pull.sh b/git-pull.sh index 2a10047eb7..be1b098be0 100755 --- a/git-pull.sh +++ b/git-pull.sh @@ -43,6 +43,7 @@ log_arg= verbosity= progress= recurse_submodules= merge_args= edit= 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) if test -z "$rebase" then @@ -113,7 +114,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) @@ -278,7 +284,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}" ;; *) -- 2.11.4.GIT