push

package
v1.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 8, 2020 License: Apache-2.0 Imports: 2 Imported by: 6

Documentation

Overview

Package push git-push - Update remote refs along with associated objects.

SYNOPSIS

Reference: https://git-scm.com/docs/git-push

git push [--all | --mirror | --tags] [--follow-tags] [--atomic] [-n | --dry-run] [--receive-pack=<git-receive-pack>]
	[--repo=<repository>] [-f | --force] [-d | --delete] [--prune] [-v | --verbose]
	[-u | --set-upstream] [--push-option=<string>]
	[--[no-]signed|--sign=(true|false|if-asked)]
	[--force-with-lease[=<refname>[:<expect>]]]
	[--no-verify] [<repository> [<refspec>...]]

DESCRIPTION

Updates remote refs using local refs, while sending objects necessary to complete the given refs.

You can make interesting things happen to a repository every time you push into it, by setting up hooks there. See documentation for git-receive-pack(1).

When the command line does not specify where to push with the <repository> argument, 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 command line does not specify what to push with <refspec>... arguments or --all, --mirror, --tags options, 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(1) for the meaning of push.default).

When neither the command-line nor the configuration specify what to push, the default behavior is used, which corresponds to the simple value for push.default: the current branch is pushed to the corresponding upstream branch, but as a safety measure, the push is aborted if the upstream branch does not have the same name as the local one.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func All

func All(g *types.Cmd)

All Push all branches (i.e. refs under refs/heads/); cannot be used with other <refspec>. --all

func Atomic

func Atomic(g *types.Cmd)

Atomic Use an atomic transaction on the remote side if available. Either all refs are updated, or on error, no refs are updated. If the server does not support atomic pushes the push will fail. --atomic

func Delete

func Delete(g *types.Cmd)

Delete All listed refs are deleted from the remote repository. This is the same as prefixing all refs with a colon. --delete

func DryRun

func DryRun(g *types.Cmd)

DryRun Do everything except actually send the updates. -n, --dry-run

func Exec added in v0.12.0

func Exec(gitReceivePack string) func(*types.Cmd)

Exec Path to the git-receive-pack program on the remote end. Sometimes useful when pushing to a remote repository over ssh, and you do not have the program in a directory on the default $PATH. --exec=<git-receive-pack>

func FollowTags

func FollowTags(g *types.Cmd)

FollowTags Push all the refs that would be pushed without this option, and also push annotated tags in refs/tags that are missing from the remote but are pointing at commit-ish that are reachable from the refs being pushed. This can also be specified with configuration variable push.followTags. For more information, see push.followTags in git-config(1). --follow-tags

func Force

func Force(g *types.Cmd)

Force Usually, the command refuses to update a remote ref that is not an ancestor of the local ref used to overwrite it. Also, when --force-with-lease option is used, the command refuses to update a remote ref whose current value does not match what is expected. -f, --force

func ForceWithLease

func ForceWithLease(g *types.Cmd)

ForceWithLease alone, without specifying the details, will protect all remote refs that are going to be updated by requiring their current value to be the same as the remote-tracking branch we have for them. Usually, "git push" refuses to update a remote ref that is not an ancestor of the local ref used to overwrite it. This option overrides this restriction if the current value of the remote ref is the expected value. "git push" fails otherwise. --force-with-lease

func ForceWithLeaseExpect added in v0.12.0

func ForceWithLeaseExpect(refname, expect string) func(*types.Cmd)

ForceWithLeaseExpect will protect the named ref (alone), if it is going to be updated, by requiring its current value to be the same as the specified value <expect> (which is allowed to be different from the remote-tracking branch we have for the refname, or we do not even have to have such a remote-tracking branch when this form is used). If <expect> is the empty string, then the named ref must not already exist. Usually, "git push" refuses to update a remote ref that is not an ancestor of the local ref used to overwrite it. This option overrides this restriction if the current value of the remote ref is the expected value. "git push" fails otherwise. --force-with-lease=<refname>:<expect>

func ForceWithLeaseRef added in v0.12.0

func ForceWithLeaseRef(refname string) func(*types.Cmd)

ForceWithLeaseRef without specifying the expected value, will protect the named ref (alone), if it is going to be updated, by requiring its current value to be the same as the remote-tracking branch we have for it. Usually, "git push" refuses to update a remote ref that is not an ancestor of the local ref used to overwrite it. This option overrides this restriction if the current value of the remote ref is the expected value. "git push" fails otherwise. --force-with-lease=<refname>

func Ipv4 added in v0.12.0

func Ipv4(g *types.Cmd)

Ipv4 Use IPv4 addresses only, ignoring IPv6 addresses. -4, --ipv4

func Ipv6 added in v0.12.0

func Ipv6(g *types.Cmd)

Ipv6 Use IPv6 addresses only, ignoring IPv4 addresses. -6, --ipv6

func Mirror

func Mirror(g *types.Cmd)

Mirror Instead of naming each ref to push, specifies that all refs under refs/ (which includes but is not limited to refs/heads/, refs/remotes/, and refs/tags/) be mirrored to the remote repository. Newly created local refs will be pushed to the remote end, locally updated refs will be force updated on the remote end, and deleted refs will be removed from the remote end. This is the default if the configuration option remote.<remote>.mirror is set. --mirror

func NoAtomic added in v0.12.0

func NoAtomic(g *types.Cmd)

NoAtomic Use an atomic transaction on the remote side if available. Either all refs are updated, or on error, no refs are updated. If the server does not support atomic pushes the push will fail. --no-atomic

func NoFollowTags added in v0.20.0

func NoFollowTags(g *types.Cmd)

NoFollowTags undocumented push option --no-follow-tags

func NoForceWithLease added in v0.12.0

func NoForceWithLease(g *types.Cmd)

NoForceWithLease Usually, "git push" refuses to update a remote ref that is not an ancestor of the local ref used to overwrite it. This option overrides this restriction if the current value of the remote ref is the expected value. "git push" fails otherwise. --[no-]force-with-lease

func NoRecurseSubmodules added in v0.12.0

func NoRecurseSubmodules(g *types.Cmd)

NoRecurseSubmodules May be used to make sure all submodule commits used by the revisions to be pushed are available on a remote-tracking branch. If check is used Git will verify that all submodule commits that changed in the revisions to be pushed are available on at least one remote of the submodule. If any commits are missing the push will be aborted and exit with non-zero status. If on-demand is used all submodules that changed in the revisions to be pushed will be pushed. If on-demand was not able to push all necessary revisions it will also be aborted and exit with non-zero status. If only is used all submodules will be recursively pushed while the superproject is left unpushed. A value of no or using --no-recurse-submodules can be used to override the push.recurseSubmodules configuration variable when no submodule recursion is required. --no-recurse-submodules

func NoSigned added in v0.12.0

func NoSigned(g *types.Cmd)

NoSigned GPG-sign the push request to update refs on the receiving side, to allow it to be checked by the hooks and/or be logged. If false or --no-signed, no signing will be attempted. If true or --signed, the push will fail if the server does not support signed pushes. If set to if-asked, sign if and only if the server supports signed pushes. The push will also fail if the actual call to gpg --sign fails. See git-receive-pack(1) for the details on the receiving end. --no-signed

func NoThin added in v0.12.0

func NoThin(g *types.Cmd)

NoThin These options are passed to git-send-pack(1). A thin transfer significantly reduces the amount of sent data when the sender and receiver share many of the same objects in common. The default is --thin. --no-thin

func NoVerify added in v0.12.0

func NoVerify(g *types.Cmd)

NoVerify Toggle the pre-push hook (see githooks(5)). The default is --verify, giving the hook a chance to prevent the push. With --no-verify, the hook is bypassed completely. --no-verify

func Porcelain added in v0.12.0

func Porcelain(g *types.Cmd)

Porcelain Produce machine-readable output. The output status line for each ref will be tab-separated and sent to stdout instead of stderr. The full symbolic names of the refs will be given. --porcelain

func Progress added in v0.12.0

func Progress(g *types.Cmd)

Progress Progress status is reported on the standard error stream by default when it is attached to a terminal, unless -q is specified. This flag forces progress status even if the standard error stream is not directed to a terminal. --progress

func Prune

func Prune(g *types.Cmd)

Prune Remove remote branches that don’t have a local counterpart. For example a remote branch tmp will be removed if a local branch with the same name doesn’t exist any more. This also respects refspecs, e.g. git push --prune remote refs/heads/*:refs/tmp/* would make sure that remote refs/tmp/foo will be removed if refs/heads/foo doesn’t exist. --prune

func PushOption

func PushOption(g *types.Cmd)

PushOption 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. -o, --push-option

func Quiet added in v0.12.0

func Quiet(g *types.Cmd)

Quiet Suppress all output, including the listing of updated refs, unless an error occurs. Progress is not reported to the standard error stream. -q, --quiet

func ReceivePack

func ReceivePack(gitReceivePack string) func(*types.Cmd)

ReceivePack Path to the git-receive-pack program on the remote end. Sometimes useful when pushing to a remote repository over ssh, and you do not have the program in a directory on the default $PATH. --receive-pack=<git-receive-pack>

func RecurseSubmodules added in v0.12.0

func RecurseSubmodules(value string) func(*types.Cmd)

RecurseSubmodules May be used to make sure all submodule commits used by the revisions to be pushed are available on a remote-tracking branch. If check is used Git will verify that all submodule commits that changed in the revisions to be pushed are available on at least one remote of the submodule. If any commits are missing the push will be aborted and exit with non-zero status. If on-demand is used all submodules that changed in the revisions to be pushed will be pushed. If on-demand was not able to push all necessary revisions it will also be aborted and exit with non-zero status. If only is used all submodules will be recursively pushed while the superproject is left unpushed. A value of no or using --no-recurse-submodules can be used to override the push.recurseSubmodules configuration variable when no submodule recursion is required. --recurse-submodules=(check|on-demand|only|no)

func RefSpec

func RefSpec(refspecs ...string) func(*types.Cmd)

RefSpec 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>. <refspec>...

func Remote

func Remote(repository string) func(*types.Cmd)

Remote The "remote" repository that is destination of a push operation. This parameter can be either a URL (see the section GIT URLS below) or the name of a remote (see the section REMOTES below). <repository>

func Repo

func Repo(repository string) func(*types.Cmd)

Repo This option is equivalent to the <repository> argument. If both are specified, the command-line argument takes precedence. --repo=<repository>

func SetUpstream

func SetUpstream(g *types.Cmd)

SetUpstream For every branch that is up to date or successfully pushed, add upstream (tracking) reference, used by argument-less git-pull(1) and other commands. For more information, see branch.<name>.merge in git-config(1). -u, --set-upstream

func Sign added in v0.12.0

func Sign(value string) func(*types.Cmd)

Sign GPG-sign the push request to update refs on the receiving side, to allow it to be checked by the hooks and/or be logged. If false or --no-signed, no signing will be attempted. If true or --signed, the push will fail if the server does not support signed pushes. If set to if-asked, sign if and only if the server supports signed pushes. The push will also fail if the actual call to gpg --sign fails. See git-receive-pack(1) for the details on the receiving end. --sign=(true|false|if-asked)

func Signed added in v0.12.0

func Signed(g *types.Cmd)

Signed GPG-sign the push request to update refs on the receiving side, to allow it to be checked by the hooks and/or be logged. If false or --no-signed, no signing will be attempted. If true or --signed, the push will fail if the server does not support signed pushes. If set to if-asked, sign if and only if the server supports signed pushes. The push will also fail if the actual call to gpg --sign fails. See git-receive-pack(1) for the details on the receiving end. --signed

func Tags

func Tags(g *types.Cmd)

Tags All refs under refs/tags are pushed, in addition to refspecs explicitly listed on the command line. --tags

func Thin added in v0.12.0

func Thin(g *types.Cmd)

Thin These options are passed to git-send-pack(1). A thin transfer significantly reduces the amount of sent data when the sender and receiver share many of the same objects in common. The default is --thin. --thin

func Verbose

func Verbose(g *types.Cmd)

Verbose Run verbosely. -v, --verbose

func Verify added in v0.12.0

func Verify(g *types.Cmd)

Verify Toggle the pre-push hook (see githooks(5)). The default is --verify, giving the hook a chance to prevent the push. With --no-verify, the hook is bypassed completely. --verify

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL