Skip to content

Commit

Permalink
Teach 'git pull' to handle --rebase=interactive
Browse files Browse the repository at this point in the history
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
  • Loading branch information
dscho committed Oct 22, 2011
1 parent 7b316a4 commit 4aa8b8c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
5 changes: 4 additions & 1 deletion Documentation/git-pull.txt
Expand Up @@ -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.<name>.rebase` and `branch.autosetuprebase` in
linkgit:git-config[1] if you want to make `git pull` always use
`{litdd}rebase` instead of merging.
Expand Down
8 changes: 7 additions & 1 deletion git-pull.sh
Expand Up @@ -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 :
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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}"
;;
*)
Expand Down

0 comments on commit 4aa8b8c

Please sign in to comment.