grgit-push
Synopsis
grgit.push()
grgit.push(remote: '<name or uri>', refsOrSpecs: [<ref or refspec>, ...],
all: <boolean>, tags: <boolean>, force: <boolean>, dryRun: <boolean>),
pushOptions: [<string>, ...]
grgit.push {
remote = '<name or uri>'
refsOrSpecs = [<ref or refspec>, ...]
all = <boolean>
tags = <boolean>
force = <boolean>
dryRun = <boolean>
pushOptions = [<string>, ...]
}
Description
Updates remote refs using local refs, while sending objects necessary to complete the given refs.
When the remote
is not specified, branch.*.remote
configuration for the current branch is consulted to determine where to push. If the configuration is missing, it defaults to origin
.
When the refsOrSpecs
or all
or tags
options are not specified, the command finds the default <refspec>
by consulting remote.*.push
configuration, and if it is not found, honors push.default
configuration to decide what to push (See git-config for the meaning of push.default
).
Options
- remote
-
(
String
, defaultnull
) The "remote" repository that is destination of a push operation. This parameter can be either a URL or the name of a remote. - refsOrSpecs
-
(
List<String>
, default[]
) Specify what destination ref to update with what source object. The format of a <refspec> parameter is an optional plus +, followed by the source object <src>, followed by a colon :, followed by the destination ref <dst>.The <src> is often the name of the branch you would want to push, but it can be any arbitrary "SHA-1 expression", such as
master~4
orHEAD
(see gitrevisions).The <dst> tells which ref on the remote side is updated with this push. Arbitrary expressions cannot be used here, an actual ref must be named. If
grgit.push(remote: '<repositor>')
without anyrefsOrSpecs
argument is set to update some ref at the destination with <src> withremote.<repository>.push
configuration variable, :<dst> part can be omitted—​such a push will update a ref that <src> normally updates without any <refspec> on the command line. Otherwise, missing :<dst> means to update the same ref as the <src>.The object referenced by <src> is used to update the <dst> reference on the remote side. By default this is only allowed if <dst> is not a tag (annotated or lightweight), and then only if it can fast-forward <dst>. By having the optional leading +, you can tell Git to update the <dst> ref even if it is not allowed by default (e.g., it is not a fast-forward.) This does not attempt to merge <src> into <dst>.
Pushing an empty <src> allows you to delete the <dst> ref from the remote repository.
The special refspec : (or +: to allow non-fast-forward updates) directs Git to push "matching" branches: for every branch that exists on the local side, the remote side is updated if a branch of the same name already exists on the remote side.
- all
-
(
boolean
, defaultfalse
) Push all branches (i.e. refs underrefs/heads/
); cannot be used with otherrefsOrSpecs
. - tags
-
(
boolean
, defaultfalse
) All refs under refs/tags are pushed, in addition to refspecs explicitly listed inrefsOrSpecs
. - force
-
(
boolean
, defaultfalse
) Usually, the command refuses to update a remote ref that is not an ancestor of the local ref used to overwrite it. Note thatforce
applies to all the refs that are pushed, hence using it withpush.default
set tomatching
or with multiple push destinations configured withremote.*.push
may overwrite refs other than the current branch (including local refs that are strictly behind their remote counterpart). To force a push to only one branch, use a + in front of the refspec to push (e.g git push origin +master to force a push to the master branch). See the <refspec>… section above for details. - dryRun
-
(
boolean
, defaultfalse
) Do everything except actually send the updates. - pushOptions
-
(
List<String>
, default[]
) Transmit the given string to the server, which passes them to the pre-receive as well as the post-receive hook. The given string must not contain a NUL or LF character. When multiplepushOptions
are given, they are all sent to the other side in the order listed. When nopushOptions
is given, the values of configuration variablepush.pushOption
are used instead.