Home Explore Blog CI



git

3rd chunk of `Documentation/git-push.adoc`
bff1190dbcd3befb95b2a87f44f17bda6c324652c21389ab0000000100000fa4
 forbidden by configuration
or hooks. See `receive.denyDeletes` in linkgit:git-config[1] and
`pre-receive` and `update` in linkgit:githooks[5].
+
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.
+
`tag <tag>` means the same as `refs/tags/<tag>:refs/tags/<tag>`.

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

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

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

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

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

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

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

--follow-tags::
	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 linkgit:git-config[1].

--[no-]signed::
--signed=(true|false|if-asked)::
	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
	linkgit:git-receive-pack[1] for the details on the receiving end.

--[no-]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.

-o <option>::
--push-option=<option>::
	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 multiple `--push-option=<option>` are given, they are
	all sent to the other side in the order listed on the
	command line.
	When no `--push-option=<option>` is given from the command
	line, the values of configuration variable `push.pushOption`
	are used instead.

--receive-pack=<git-receive-pack>::
--exec=<git-receive-pack>::
	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.

--[no-]force-with-lease::
--force-with-lease=<refname>::
--force-with-lease=<refname>:<expect>::
	Usually, "git push" refuses to update a remote ref that is
	not an ancestor of the local ref used

Title: Git Push Options and Behavior
Summary
The git push command has various options to control its behavior, including refspecs, forcing updates, pruning, mirroring, and signed pushes, as well as configuration options and hooks to customize the push process, allowing for fine-grained control over what refs are pushed, updated, or deleted on the remote repository.