Magit's branch creation commands use git branch new-branch start-point
, which in some cases automatically sets start-point
as the upstream. Unfortunately it does not do so in all cases in which it should do so IMO.
The relevant documentation is this:
branch.autoSetupMerge
Tells git branch, git switch and git checkout to set up new
branches so that git-pull(1) will appropriately merge from the
starting point branch. Note that even if this option is not set,
this behavior can be chosen per-branch using the --track and
--no-track options. The valid settings are: false — no automatic
setup is done; true — automatic setup is done when the starting
point is a remote-tracking branch; always — automatic setup is
done when the starting point is either a local branch or
remote-tracking branch. This option defaults to true.
So you want to set that variable to always
.
Additionally you might want to read about the magit-branch-adjust-remote-upstream-alist
option.
These things are described in more details in the Branch Commands and Branch Git Variables sections of the Magit manual. I recommend you also read the surrounding sections.