6.6.3 Branch Git Variables
These variables can be set from the transient prefix command magit-branch-configure
. By default they can also be set from magit-branch
. See Branch Commands.
variable
branch.NAME.mergeβ
Together with branch.NAME.remote
this variable defines the upstream branch of the local branch named NAME. The value of this variable is the full reference of the upstream branch.
variable
branch.NAME.remoteβ
Together with branch.NAME.merge
this variable defines the upstream branch of the local branch named NAME. The value of this variable is the name of the upstream remote.
variable
branch.NAME.rebaseβ
This variable controls whether pulling into the branch named NAME is done by rebasing or by merging the fetched branch.
- When
true
then pulling is done by rebasing. - When
false
then pulling is done by merging. - When undefined then the value of
pull.rebase
is used. The default of that variable isfalse
.
variable
branch.NAME.pushRemoteβ
This variable specifies the remote that the branch named NAME is usually pushed to. The value has to be the name of an existing remote.
It is not possible to specify the name of branch to push the local branch to. The name of the remote branch is always the same as the name of the local branch.
If this variable is undefined but remote.pushDefault
is defined, then the value of the latter is used. By default remote.pushDefault
is undefined.
variable
branch.NAME.descriptionβ
This variable can be used to describe the branch named NAME. That description is used e.g. when turning the branch into a series of patches.
The following variables specify defaults which are used if the above branch-specific variables are not set.
variable
pull.rebaseβ
This variable specifies whether pulling is done by rebasing or by merging. It can be overwritten using branch.NAME.rebase
.
- When
true
then pulling is done by rebasing. - When
false
(the default) then pulling is done by merging.
Since it is never a good idea to merge the upstream branch into a feature or hotfix branch and most branches are such branches, you should consider setting this to true
, and branch.master.rebase
to false
.
variable
remote.pushDefaultβ
This variable specifies what remote the local branches are usually pushed to. This can be overwritten per branch using branch.NAME.pushRemote
.
The following variables are used during the creation of a branch and control whether the various branch-specific variables are automatically set at this time.
variable
branch.autoSetupMergeβ
This variable specifies under what circumstances creating a branch NAME should result in the variables branch.NAME.merge
and branch.NAME.remote
being set according to the starting point used to create the branch. If the starting point isnβt a branch, then these variables are never set.
- When
always
then the variables are set regardless of whether the starting point is a local or a remote branch. - When
true
(the default) then the variables are set when the starting point is a remote branch, but not when it is a local branch. - When
false
then the variables are never set.
variable
branch.autoSetupRebaseβ
This variable specifies whether creating a branch NAME should result in the variable branch.NAME.rebase
being set to true
.
- When
always
then the variable is set regardless of whether the starting point is a local or a remote branch. - When
local
then the variable are set when the starting point is a local branch, but not when it is a remote branch. - When
remote
then the variable are set when the starting point is a remote branch, but not when it is a local branch. - When
never
(the default) then the variable is never set.
Note that the respective commands always change the repository-local values. If you want to change the global value, which is used when the local value is undefined, then you have to do so on the command line, e.g.:
git config --global remote.autoSetupMerge always
For more information about these variables you should also see
the git-config(1) manpage.
Also see the git-branch(1) manpage. , the git-checkout(1) manpage. and Pushing.
user option
magit-prefer-remote-upstreamβ
This option controls whether commands that read a branch from the user and then set it as the upstream branch, offer a local or a remote branch as default completion candidate, when they have the choice.
This affects all commands that use magit-read-upstream-branch
or magit-read-starting-point
, which includes all commands that change the upstream and many which create new branches.