Teach 'git pull' to handle --rebase=interactive

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This commit is contained in:
Johannes Schindelin
2011-10-21 23:27:09 -05:00
parent 7b316a49b5
commit 4aa8b8c828
2 changed files with 11 additions and 2 deletions

View File

@@ -101,13 +101,16 @@ include::merge-options.txt[]
:git-pull: 1 :git-pull: 1
--rebase:: --rebase[=interactive]::
Rebase the current branch on top of the upstream branch after Rebase the current branch on top of the upstream branch after
fetching. If there is a remote-tracking branch corresponding to fetching. If there is a remote-tracking branch corresponding to
the upstream branch and the upstream branch was rebased since last the upstream branch and the upstream branch was rebased since last
fetched, the rebase uses that information to avoid rebasing fetched, the rebase uses that information to avoid rebasing
non-local changes. non-local changes.
+ +
The optional mode `interactive` tells Git to switch on rebase's interactive
mode.
+
See `branch.<name>.rebase` and `branch.autosetuprebase` in See `branch.<name>.rebase` and `branch.autosetuprebase` in
linkgit:git-config[1] if you want to make `git pull` always use linkgit:git-config[1] if you want to make `git pull` always use
`{litdd}rebase` instead of merging. `{litdd}rebase` instead of merging.

View File

@@ -43,6 +43,7 @@ log_arg= verbosity= progress= recurse_submodules=
merge_args= merge_args=
curr_branch=$(git symbolic-ref -q HEAD) curr_branch=$(git symbolic-ref -q HEAD)
curr_branch_short="${curr_branch#refs/heads/}" curr_branch_short="${curr_branch#refs/heads/}"
rebase_options=
rebase=$(git config --bool branch.$curr_branch_short.rebase) rebase=$(git config --bool branch.$curr_branch_short.rebase)
dry_run= dry_run=
while : while :
@@ -105,7 +106,12 @@ do
-r|--r|--re|--reb|--reba|--rebas|--rebase) -r|--r|--re|--reb|--reba|--rebas|--rebase)
rebase=true rebase=true
;; ;;
--rebase=i|--rebase=interactive)
rebase_options=-i
rebase=true
;;
--no-r|--no-re|--no-reb|--no-reba|--no-rebas|--no-rebase) --no-r|--no-re|--no-reb|--no-reba|--no-rebas|--no-rebase)
rebase_options=
rebase=false rebase=false
;; ;;
--recurse-submodules) --recurse-submodules)
@@ -270,7 +276,7 @@ fi
merge_name=$(git fmt-merge-msg $log_arg <"$GIT_DIR/FETCH_HEAD") || exit merge_name=$(git fmt-merge-msg $log_arg <"$GIT_DIR/FETCH_HEAD") || exit
case "$rebase" in case "$rebase" in
true) 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}" eval="$eval --onto $merge_head ${oldremoteref:-$merge_head}"
;; ;;
*) *)