Pull uses --rebase with prefix arg.

This commit is contained in:
Phil Jackson 2010-08-09 22:58:11 +01:00
parent 2af1a122e5
commit 861e555983
2 changed files with 9 additions and 6 deletions

View file

@ -3035,15 +3035,17 @@ update it."
(remote (magit-run-git-async "fetch" remote)) (remote (magit-run-git-async "fetch" remote))
(t (magit-run-git-async "remote" "update")))) (t (magit-run-git-async "remote" "update"))))
(magit-define-command pull () (magit-define-command pull (&optional rebase)
(interactive) "Run git pull against the current remote. With a prefix arg
will run pull with --rebase."
(interactive "P")
(let* ((branch (magit-get-current-branch)) (let* ((branch (magit-get-current-branch))
(config-branch (and branch (magit-get "branch" branch "merge"))) (config-branch (and branch (magit-get "branch" branch "merge")))
(merge-branch (or config-branch (merge-branch (or config-branch
(magit-read-rev (format "Pull from"))))) (magit-read-rev (format "Pull from")))))
(if (and branch (not config-branch)) (if (and branch (not config-branch))
(magit-set merge-branch "branch" branch "merge")) (magit-set merge-branch "branch" branch "merge"))
(magit-run-git-async "pull" "-v"))) (apply 'magit-run-git-async `("pull" "-v" ,@(and rebase '("--rebase"))))))
(eval-when-compile (require 'pcomplete)) (eval-when-compile (require 'pcomplete))

View file

@ -661,9 +661,10 @@ only push the current branch to the remote. In other words, it will run
remote if it doesn't exist already. The local branch will be configured remote if it doesn't exist already. The local branch will be configured
so that it pulls from the new remote branch. so that it pulls from the new remote branch.
Typing @kbd{f} will run @code{git remote update}. With a prefix arg, it Typing @kbd{f} will run @code{git remote update}. With a prefix arg,
will prompt for the name of the remote to update. Typing @kbd{F} will it will prompt for the name of the remote to update. Typing @kbd{F}
run @code{git pull}. When you don't have a default branch configured to will run @code{git pull} (with a prefix arg will pull with
@code{--rebase}). When you don't have a default branch configured to
be pulled into the current one, you will be asked for it. be pulled into the current one, you will be asked for it.
If there is a default remote repository for the current branch, Magit If there is a default remote repository for the current branch, Magit