Next: , Previous: , Up: Branching   [Contents][Index]


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 is false.
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.


Next: Auxiliary Branch Commands, Previous: Branch Commands, Up: Branching   [Contents][Index]