I have upstream set to develop branch (say origin/master) and pushRemote to feature branch.

I currently use pulling with preserving rebase.

I would like to setup magit in such a way that:

  • this would be used by default for feature branch (pushRemote)
  • but pulling from develop branch should be done with merge (upstream).

Is it possible to reconfigure magit for that behavior? Probably this could be configured in git itself?


I came up with a safe-guard to prevent me from accidentally rewriting history by applying the following advice:

(defun my-magit-pull-from-upstream (org-fun &rest args)
  (if (yes-or-no-p "Do you really want to pull (rebase) from upstream? ")
      (apply org-fun args)
    (when (yes-or-no-p "Do you want to merge from upstream? ")
      (setq args '("--no-rebase"))
      (apply org-fun args))))

(advice-add 'magit-pull-from-upstream :around #'my-magit-pull-from-upstream)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.