7.4 Pushing
Also see the git-push(1) manpage. For information about the upstream and the push-remote, see The Two Remotes.
P
    (magit-push
)​
This transient prefix command binds the following suffix commands along with the appropriate infix arguments and displays them in a temporary buffer until a suffix is invoked.
P p
    (magit-push-current-to-pushremote
)​
This command pushes the current branch to its push-remote.
With a prefix argument or when the push-remote is either not configured or unusable, then let the user first configure the push-remote.
P u
    (magit-push-current-to-upstream
)​
This command pushes the current branch to its upstream branch.
With a prefix argument or when the upstream is either not configured or unusable, then let the user first configure the upstream.
P e
    (magit-push-current
)​
This command pushes the current branch to a branch read in the minibuffer.
P o
    (magit-push-other
)​
This command pushes an arbitrary branch or commit somewhere. Both the source and the target are read in the minibuffer.
P r
    (magit-push-refspecs
)​
This command pushes one or multiple refspecs to a remote, both of which are read in the minibuffer.
To use multiple refspecs, separate them with commas. Completion is only available for the part before the colon, or when no colon is used.
P m
    (magit-push-matching
)​
This command pushes all matching branches to another repository.
If only one remote exists, then push to that. Otherwise prompt for a remote, offering the remote configured for the current branch as default.
P t
    (magit-push-tags
)​
This command pushes all tags to another repository.
If only one remote exists, then push to that. Otherwise prompt for a remote, offering the remote configured for the current branch as default.
P T
    (magit-push-tag
)​
This command pushes a tag to another repository.
One of the infix arguments, --force-with-lease
, deserves a word of caution. It is passed without a value, which means "permit a force push as long as the remote-tracking branches match their counterparts on the remote end". If you’ve set up a tool to do automatic fetches (Magit itself does not provide such functionality), using --force-with-lease
can be dangerous because you don’t actually control or know the state of the remote-tracking refs. In that case, you should consider setting push.useForceIfIncludes
to true
(available since Git 2.30).
Two more push commands exist, which by default are not available from the push transient. See their doc-strings for instructions on how to add them to the transient.
command
magit-push-implicitly args​
This command pushes somewhere without using an explicit refspec.
This command simply runs git push -v [ARGS]
. ARGS are the infix arguments. No explicit refspec arguments are used. Instead the behavior depends on at least these Git variables: push.default
, remote.pushDefault
, branch.<branch>.pushRemote
, branch.<branch>.remote
, branch.<branch>.merge
, and remote.<remote>.push
.
If you add this suffix to a transient prefix without explicitly specifying the description, then an attempt is made to predict what this command will do. For example:
(transient-insert-suffix 'magit-push \"p\"
'(\"i\" magit-push-implicitly))"
command
magit-push-to-remote remote args​
This command pushes to the remote REMOTE without using an explicit refspec. The remote is read in the minibuffer.
This command simply runs git push -v [ARGS] REMOTE
. ARGS are the infix arguments. No refspec arguments are used. Instead the behavior depends on at least these Git variables: push.default
, remote.pushDefault
, branch.<branch>.pushRemote
, branch.<branch>.remote
, branch.<branch>.merge
, and remote.<remote>.push
.