2005-09-08 00:26:23 +00:00
|
|
|
git-push(1)
|
|
|
|
===========
|
2005-08-23 08:49:47 +00:00
|
|
|
|
|
|
|
NAME
|
|
|
|
----
|
2006-03-09 16:24:50 +00:00
|
|
|
git-push - Update remote refs along with associated objects
|
2005-08-23 08:49:47 +00:00
|
|
|
|
|
|
|
|
|
|
|
SYNOPSIS
|
|
|
|
--------
|
2007-05-18 13:39:34 +00:00
|
|
|
[verse]
|
2015-01-08 03:23:23 +00:00
|
|
|
'git push' [--all | --mirror | --tags] [--follow-tags] [--atomic] [-n | --dry-run] [--receive-pack=<git-receive-pack>]
|
2015-12-14 15:23:04 +00:00
|
|
|
[--repo=<repository>] [-f | --force] [-d | --delete] [--prune] [-v | --verbose]
|
2018-05-03 18:48:27 +00:00
|
|
|
[-u | --set-upstream] [-o <string> | --push-option=<string>]
|
Doc/git-{push,send-pack}: correct --sign= to --signed=
Since we're about to touch the behavior of --signed=, do this as a
preparatory step.
The documentation mentions --sign=, and it works. But that's just
because it's an unambiguous abbreviation of --signed, which is how it is
actually implemented. This was added in commit 30261094 ("push: support
signing pushes iff the server supports it", 2015-08-19). Back when that
series was developed [1] [2], there were suggestions about both --sign=
and --signed=. The final implementation settled on --signed=, but some
of the documentation and commit messages ended up using --sign=.
The option is referred to as --signed= in Documentation/config.txt
(under push.gpgSign).
One could argue that we have promised --sign for two years now, so we
should implement it as an alias for --signed. (Then we might also
deprecate the latter, something which was considered already then.) That
would be a slightly more intrusive change.
This minor issue would only be a problem once we want to implement some
other option --signfoo, but the earlier we do this step, the better.
[1] v1-thread:
https://public-inbox.org/git/1439492451-11233-1-git-send-email-dborowitz@google.com/T/#u
[2] v2-thread:
https://public-inbox.org/git/1439998007-28719-1-git-send-email-dborowitz@google.com/T/#m6533a6c4707a30b0d81e86169ff8559460cbf6eb
Signed-off-by: Martin Ågren <martin.agren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-08-07 18:20:45 +00:00
|
|
|
[--[no-]signed|--signed=(true|false|if-asked)]
|
2020-10-03 12:10:46 +00:00
|
|
|
[--force-with-lease[=<refname>[:<expect>]] [--force-if-includes]]
|
2013-05-23 13:34:11 +00:00
|
|
|
[--no-verify] [<repository> [<refspec>...]]
|
2005-08-23 08:49:47 +00:00
|
|
|
|
|
|
|
DESCRIPTION
|
|
|
|
-----------
|
2005-08-24 23:23:08 +00:00
|
|
|
|
|
|
|
Updates remote refs using local refs, while sending objects
|
|
|
|
necessary to complete the given refs.
|
2005-08-23 08:49:47 +00:00
|
|
|
|
2006-02-06 00:42:27 +00:00
|
|
|
You can make interesting things happen to a repository
|
2005-12-05 08:32:01 +00:00
|
|
|
every time you push into it, by setting up 'hooks' there. See
|
2007-12-29 06:20:38 +00:00
|
|
|
documentation for linkgit:git-receive-pack[1].
|
2005-12-05 08:32:01 +00:00
|
|
|
|
2013-03-08 17:44:33 +00:00
|
|
|
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
|
2014-11-17 00:49:00 +00:00
|
|
|
what to push (See linkgit:git-config[1] for the meaning of `push.default`).
|
2013-03-08 17:44:33 +00:00
|
|
|
|
2016-02-23 21:04:41 +00:00
|
|
|
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.
|
|
|
|
|
2005-08-23 08:49:47 +00:00
|
|
|
|
2009-03-15 02:32:01 +00:00
|
|
|
OPTIONS[[OPTIONS]]
|
|
|
|
------------------
|
2006-02-05 22:43:47 +00:00
|
|
|
<repository>::
|
2006-02-05 23:29:49 +00:00
|
|
|
The "remote" repository that is destination of a push
|
2009-01-18 14:36:55 +00:00
|
|
|
operation. This parameter can be either a URL
|
|
|
|
(see the section <<URLS,GIT URLS>> below) or the name
|
|
|
|
of a remote (see the section <<REMOTES,REMOTES>> below).
|
2006-02-05 22:43:47 +00:00
|
|
|
|
2008-07-29 23:13:38 +00:00
|
|
|
<refspec>...::
|
2013-03-08 17:44:33 +00:00
|
|
|
Specify what destination ref to update with what source object.
|
2009-01-26 06:25:20 +00:00
|
|
|
The format of a <refspec> parameter is an optional plus
|
2013-03-08 17:44:33 +00:00
|
|
|
`+`, followed by the source object <src>, followed
|
2009-01-26 06:25:20 +00:00
|
|
|
by a colon `:`, followed by the destination ref <dst>.
|
2006-02-05 22:43:47 +00:00
|
|
|
+
|
2009-01-25 23:45:33 +00:00
|
|
|
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` or
|
2010-10-11 16:03:32 +00:00
|
|
|
`HEAD` (see linkgit:gitrevisions[7]).
|
2006-02-05 22:43:47 +00:00
|
|
|
+
|
2009-01-25 23:45:33 +00:00
|
|
|
The <dst> tells which ref on the remote side is updated with this
|
|
|
|
push. Arbitrary expressions cannot be used here, an actual ref must
|
push: use remote.$name.push as a refmap
Since f2690487 (fetch: opportunistically update tracking refs,
2013-05-11), we stopped taking a non-storing refspec given on the
command line of "git fetch" literally, and instead started mapping
it via remote.$name.fetch refspecs. This allows
$ git fetch origin master
from the 'origin' repository, which is configured with
[remote "origin"]
fetch = +refs/heads/*:refs/remotes/origin/*
to update refs/remotes/origin/master with the result, as if the
command line were
$ git fetch origin +master:refs/remotes/origin/master
to reduce surprises and improve usability. Before that change, a
refspec on the command line without a colon was only to fetch the
history and leave the result in FETCH_HEAD, without updating the
remote-tracking branches.
When you are simulating a fetch from you by your mothership with a
push by you into your mothership, instead of having:
[remote "satellite"]
fetch = +refs/heads/*:refs/remotes/satellite/*
on the mothership repository and running:
mothership$ git fetch satellite
you would have:
[remote "mothership"]
push = +refs/heads/*:refs/remotes/satellite/*
on your satellite machine, and run:
satellite$ git push mothership
Because we so far did not make the corresponding change to the push
side, this command:
satellite$ git push mothership master
does _not_ allow you on the satellite to only push 'master' out but
still to the usual destination (i.e. refs/remotes/satellite/master).
Implement the logic to map an unqualified refspec given on the
command line via the remote.$name.push refspec. This will bring a
bit more symmetry between "fetch" and "push".
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-12-03 23:41:15 +00:00
|
|
|
be named.
|
|
|
|
If `git push [<repository>]` without any `<refspec>` argument is set to
|
|
|
|
update some ref at the destination with `<src>` with
|
|
|
|
`remote.<repository>.push` configuration variable, `:<dst>` part can
|
2015-10-22 20:02:33 +00:00
|
|
|
be omitted--such a push will update a ref that `<src>` normally updates
|
push: use remote.$name.push as a refmap
Since f2690487 (fetch: opportunistically update tracking refs,
2013-05-11), we stopped taking a non-storing refspec given on the
command line of "git fetch" literally, and instead started mapping
it via remote.$name.fetch refspecs. This allows
$ git fetch origin master
from the 'origin' repository, which is configured with
[remote "origin"]
fetch = +refs/heads/*:refs/remotes/origin/*
to update refs/remotes/origin/master with the result, as if the
command line were
$ git fetch origin +master:refs/remotes/origin/master
to reduce surprises and improve usability. Before that change, a
refspec on the command line without a colon was only to fetch the
history and leave the result in FETCH_HEAD, without updating the
remote-tracking branches.
When you are simulating a fetch from you by your mothership with a
push by you into your mothership, instead of having:
[remote "satellite"]
fetch = +refs/heads/*:refs/remotes/satellite/*
on the mothership repository and running:
mothership$ git fetch satellite
you would have:
[remote "mothership"]
push = +refs/heads/*:refs/remotes/satellite/*
on your satellite machine, and run:
satellite$ git push mothership
Because we so far did not make the corresponding change to the push
side, this command:
satellite$ git push mothership master
does _not_ allow you on the satellite to only push 'master' out but
still to the usual destination (i.e. refs/remotes/satellite/master).
Implement the logic to map an unqualified refspec given on the
command line via the remote.$name.push refspec. This will bring a
bit more symmetry between "fetch" and "push".
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-12-03 23:41:15 +00:00
|
|
|
without any `<refspec>` on the command line. Otherwise, missing
|
|
|
|
`:<dst>` means to update the same ref as the `<src>`.
|
2006-02-05 22:43:47 +00:00
|
|
|
+
|
2018-11-13 19:52:45 +00:00
|
|
|
If <dst> doesn't start with `refs/` (e.g. `refs/heads/master`) we will
|
|
|
|
try to infer where in `refs/*` on the destination <repository> it
|
2019-08-10 05:59:14 +00:00
|
|
|
belongs based on the type of <src> being pushed and whether <dst>
|
2018-11-13 19:52:45 +00:00
|
|
|
is ambiguous.
|
|
|
|
+
|
|
|
|
--
|
|
|
|
* If <dst> unambiguously refers to a ref on the <repository> remote,
|
|
|
|
then push to that ref.
|
|
|
|
|
|
|
|
* If <src> resolves to a ref starting with refs/heads/ or refs/tags/,
|
|
|
|
then prepend that to <dst>.
|
|
|
|
|
|
|
|
* Other ambiguity resolutions might be added in the future, but for
|
|
|
|
now any other cases will error out with an error indicating what we
|
|
|
|
tried, and depending on the `advice.pushUnqualifiedRefname`
|
|
|
|
configuration (see linkgit:git-config[1]) suggest what refs/
|
|
|
|
namespace you may have wanted to push to.
|
|
|
|
|
|
|
|
--
|
|
|
|
+
|
2009-02-19 17:39:47 +00:00
|
|
|
The object referenced by <src> is used to update the <dst> reference
|
2018-08-31 20:10:02 +00:00
|
|
|
on the remote side. Whether this is allowed depends on where in
|
|
|
|
`refs/*` the <dst> reference lives as described in detail below, in
|
|
|
|
those sections "update" means any modifications except deletes, which
|
|
|
|
as noted after the next few sections are treated differently.
|
2006-02-05 22:43:47 +00:00
|
|
|
+
|
2018-08-31 20:10:02 +00:00
|
|
|
The `refs/heads/*` namespace will only accept commit objects, and
|
|
|
|
updates only if they can be fast-forwarded.
|
|
|
|
+
|
|
|
|
The `refs/tags/*` namespace will accept any kind of object (as
|
|
|
|
commits, trees and blobs can be tagged), and any updates to them will
|
|
|
|
be rejected.
|
|
|
|
+
|
|
|
|
It's possible to push any type of object to any namespace outside of
|
|
|
|
`refs/{tags,heads}/*`. In the case of tags and commits, these will be
|
|
|
|
treated as if they were the commits inside `refs/heads/*` for the
|
|
|
|
purposes of whether the update is allowed.
|
|
|
|
+
|
|
|
|
I.e. a fast-forward of commits and tags outside `refs/{tags,heads}/*`
|
|
|
|
is allowed, even in cases where what's being fast-forwarded is not a
|
|
|
|
commit, but a tag object which happens to point to a new commit which
|
|
|
|
is a fast-forward of the commit the last tag (or commit) it's
|
|
|
|
replacing. Replacing a tag with an entirely different tag is also
|
|
|
|
allowed, if it points to the same commit, as well as pushing a peeled
|
|
|
|
tag, i.e. pushing the commit that existing tag object points to, or a
|
|
|
|
new tag object which an existing commit points to.
|
|
|
|
+
|
|
|
|
Tree and blob objects outside of `refs/{tags,heads}/*` will be treated
|
|
|
|
the same way as if they were inside `refs/tags/*`, any update of them
|
|
|
|
will be rejected.
|
|
|
|
+
|
|
|
|
All of the rules described above about what's not allowed as an update
|
|
|
|
can be overridden by adding an the optional leading `+` to a refspec
|
|
|
|
(or using `--force` command line option). The only exception to this
|
|
|
|
is that no amount of forcing will make the `refs/heads/*` namespace
|
|
|
|
accept a non-commit object. Hooks and configuration can also override
|
|
|
|
or amend these rules, see e.g. `receive.denyNonFastForwards` in
|
2018-09-18 05:47:38 +00:00
|
|
|
linkgit:git-config[1] and `pre-receive` and `update` in
|
2018-08-31 20:10:02 +00:00
|
|
|
linkgit:githooks[5].
|
|
|
|
+
|
|
|
|
Pushing an empty <src> allows you to delete the <dst> ref from the
|
|
|
|
remote repository. Deletions are always accepted without a leading `+`
|
|
|
|
in the refspec (or `--force`), except when forbidden by configuration
|
|
|
|
or hooks. See `receive.denyDeletes` in linkgit:git-config[1] and
|
|
|
|
`pre-receive` and `update` in linkgit:githooks[5].
|
2008-04-28 15:32:12 +00:00
|
|
|
+
|
docs: stop using asciidoc no-inline-literal
In asciidoc 7, backticks like `foo` produced a typographic
effect, but did not otherwise affect the syntax. In asciidoc
8, backticks introduce an "inline literal" inside which markup
is not interpreted. To keep compatibility with existing
documents, asciidoc 8 has a "no-inline-literal" attribute to
keep the old behavior. We enabled this so that the
documentation could be built on either version.
It has been several years now, and asciidoc 7 is no longer
in wide use. We can now decide whether or not we want
inline literals on their own merits, which are:
1. The source is much easier to read when the literal
contains punctuation. You can use `master~1` instead
of `master{tilde}1`.
2. They are less error-prone. Because of point (1), we
tend to make mistakes and forget the extra layer of
quoting.
This patch removes the no-inline-literal attribute from the
Makefile and converts every use of backticks in the
documentation to an inline literal (they must be cleaned up,
or the example above would literally show "{tilde}" in the
output).
Problematic sites were found by grepping for '`.*[{\\]' and
examined and fixed manually. The results were then verified
by comparing the output of "html2text" on the set of
generated html pages. Doing so revealed that in addition to
making the source more readable, this patch fixes several
formatting bugs:
- HTML rendering used the ellipsis character instead of
literal "..." in code examples (like "git log A...B")
- some code examples used the right-arrow character
instead of '->' because they failed to quote
- api-config.txt did not quote tilde, and the resulting
HTML contained a bogus snippet like:
<tt><sub></tt> foo <tt></sub>bar</tt>
which caused some parsers to choke and omit whole
sections of the page.
- git-commit.txt confused ``foo`` (backticks inside a
literal) with ``foo'' (matched double-quotes)
- mentions of `A U Thor <author@example.com>` used to
erroneously auto-generate a mailto footnote for
author@example.com
- the description of --word-diff=plain incorrectly showed
the output as "[-removed-] and {added}", not "{+added+}".
- using "prime" notation like:
commit `C` and its replacement `C'`
confused asciidoc into thinking that everything between
the first backtick and the final apostrophe were meant
to be inside matched quotes
- asciidoc got confused by the escaping of some of our
asterisks. In particular,
`credential.\*` and `credential.<url>.\*`
properly escaped the asterisk in the first case, but
literally passed through the backslash in the second
case.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-04-26 08:51:57 +00:00
|
|
|
The special refspec `:` (or `+:` to allow non-fast-forward updates)
|
2013-01-21 19:17:53 +00:00
|
|
|
directs Git to push "matching" branches: for every branch that exists on
|
2009-01-18 14:36:57 +00:00
|
|
|
the local side, the remote side is updated if a branch of the same name
|
2013-03-08 17:44:33 +00:00
|
|
|
already exists on the remote side.
|
2018-08-31 20:10:01 +00:00
|
|
|
+
|
|
|
|
`tag <tag>` means the same as `refs/tags/<tag>:refs/tags/<tag>`.
|
2005-08-23 08:49:47 +00:00
|
|
|
|
2008-06-08 01:36:09 +00:00
|
|
|
--all::
|
2013-01-05 00:02:29 +00:00
|
|
|
Push all branches (i.e. refs under `refs/heads/`); cannot be
|
|
|
|
used with other <refspec>.
|
2005-10-20 04:25:39 +00:00
|
|
|
|
2012-02-22 22:43:41 +00:00
|
|
|
--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.
|
docs: stop using asciidoc no-inline-literal
In asciidoc 7, backticks like `foo` produced a typographic
effect, but did not otherwise affect the syntax. In asciidoc
8, backticks introduce an "inline literal" inside which markup
is not interpreted. To keep compatibility with existing
documents, asciidoc 8 has a "no-inline-literal" attribute to
keep the old behavior. We enabled this so that the
documentation could be built on either version.
It has been several years now, and asciidoc 7 is no longer
in wide use. We can now decide whether or not we want
inline literals on their own merits, which are:
1. The source is much easier to read when the literal
contains punctuation. You can use `master~1` instead
of `master{tilde}1`.
2. They are less error-prone. Because of point (1), we
tend to make mistakes and forget the extra layer of
quoting.
This patch removes the no-inline-literal attribute from the
Makefile and converts every use of backticks in the
documentation to an inline literal (they must be cleaned up,
or the example above would literally show "{tilde}" in the
output).
Problematic sites were found by grepping for '`.*[{\\]' and
examined and fixed manually. The results were then verified
by comparing the output of "html2text" on the set of
generated html pages. Doing so revealed that in addition to
making the source more readable, this patch fixes several
formatting bugs:
- HTML rendering used the ellipsis character instead of
literal "..." in code examples (like "git log A...B")
- some code examples used the right-arrow character
instead of '->' because they failed to quote
- api-config.txt did not quote tilde, and the resulting
HTML contained a bogus snippet like:
<tt><sub></tt> foo <tt></sub>bar</tt>
which caused some parsers to choke and omit whole
sections of the page.
- git-commit.txt confused ``foo`` (backticks inside a
literal) with ``foo'' (matched double-quotes)
- mentions of `A U Thor <author@example.com>` used to
erroneously auto-generate a mailto footnote for
author@example.com
- the description of --word-diff=plain incorrectly showed
the output as "[-removed-] and {added}", not "{+added+}".
- using "prime" notation like:
commit `C` and its replacement `C'`
confused asciidoc into thinking that everything between
the first backtick and the final apostrophe were meant
to be inside matched quotes
- asciidoc got confused by the escaping of some of our
asterisks. In particular,
`credential.\*` and `credential.<url>.\*`
properly escaped the asterisk in the first case, but
literally passed through the backslash in the second
case.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-04-26 08:51:57 +00:00
|
|
|
`git push --prune remote refs/heads/*:refs/tmp/*` would
|
2012-02-22 22:43:41 +00:00
|
|
|
make sure that remote `refs/tmp/foo` will be removed if `refs/heads/foo`
|
|
|
|
doesn't exist.
|
|
|
|
|
2008-06-08 01:36:09 +00:00
|
|
|
--mirror::
|
2007-11-09 23:32:57 +00:00
|
|
|
Instead of naming each ref to push, specifies that all
|
docs: don't talk about $GIT_DIR/refs/ everywhere
It is misleading to say that we pull refs from $GIT_DIR/refs/*, because we
may also consult the packed refs mechanism. These days we tend to treat
the "refs hierarchy" as more of an abstract namespace that happens to be
represented as $GIT_DIR/refs. At best, this is a minor inaccuracy, but at
worst it can confuse users who then look in $GIT_DIR/refs and find that it
is missing some of the refs they expected to see.
This patch drops most uses of "$GIT_DIR/refs/*", changing them into just
"refs/*", under the assumption that users can handle the concept of an
abstract refs namespace. There are a few things to note:
- most cases just dropped the $GIT_DIR/ portion. But for cases where
that left _just_ the word "refs", I changed it to "refs/" to help
indicate that it was a hierarchy. I didn't do the same for longer
paths (e.g., "refs/heads" remained, instead of becoming
"refs/heads/").
- in some cases, no change was made, as the text was explicitly about
unpacked refs (e.g., the discussion in git-pack-refs).
- In some cases it made sense instead to note the existence of packed
refs (e.g., in check-ref-format and rev-parse).
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-02-18 01:16:20 +00:00
|
|
|
refs under `refs/` (which includes but is not
|
2008-06-21 03:25:25 +00:00
|
|
|
limited to `refs/heads/`, `refs/remotes/`, and `refs/tags/`)
|
2007-11-09 23:32:57 +00:00
|
|
|
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
|
2008-04-17 11:17:20 +00:00
|
|
|
will be removed from the remote end. This is the default
|
|
|
|
if the configuration option `remote.<remote>.mirror` is
|
|
|
|
set.
|
2007-11-09 23:32:57 +00:00
|
|
|
|
2009-09-13 16:56:45 +00:00
|
|
|
-n::
|
2008-06-08 01:36:09 +00:00
|
|
|
--dry-run::
|
2007-10-11 19:32:27 +00:00
|
|
|
Do everything except actually send the updates.
|
|
|
|
|
2009-06-23 01:10:01 +00:00
|
|
|
--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.
|
|
|
|
|
2018-05-03 18:48:27 +00:00
|
|
|
-d::
|
2009-12-30 19:57:42 +00:00
|
|
|
--delete::
|
|
|
|
All listed refs are deleted from the remote repository. This is
|
|
|
|
the same as prefixing all refs with a colon.
|
|
|
|
|
2008-06-08 01:36:09 +00:00
|
|
|
--tags::
|
docs: don't talk about $GIT_DIR/refs/ everywhere
It is misleading to say that we pull refs from $GIT_DIR/refs/*, because we
may also consult the packed refs mechanism. These days we tend to treat
the "refs hierarchy" as more of an abstract namespace that happens to be
represented as $GIT_DIR/refs. At best, this is a minor inaccuracy, but at
worst it can confuse users who then look in $GIT_DIR/refs and find that it
is missing some of the refs they expected to see.
This patch drops most uses of "$GIT_DIR/refs/*", changing them into just
"refs/*", under the assumption that users can handle the concept of an
abstract refs namespace. There are a few things to note:
- most cases just dropped the $GIT_DIR/ portion. But for cases where
that left _just_ the word "refs", I changed it to "refs/" to help
indicate that it was a hierarchy. I didn't do the same for longer
paths (e.g., "refs/heads" remained, instead of becoming
"refs/heads/").
- in some cases, no change was made, as the text was explicitly about
unpacked refs (e.g., the discussion in git-pack-refs).
- In some cases it made sense instead to note the existence of packed
refs (e.g., in check-ref-format and rev-parse).
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-02-18 01:16:20 +00:00
|
|
|
All refs under `refs/tags` are pushed, in
|
2006-01-16 07:27:34 +00:00
|
|
|
addition to refspecs explicitly listed on the command
|
|
|
|
line.
|
|
|
|
|
2013-03-04 20:09:50 +00:00
|
|
|
--follow-tags::
|
|
|
|
Push all the refs that would be pushed without this option,
|
|
|
|
and also push annotated tags in `refs/tags` that are missing
|
2013-09-04 19:04:31 +00:00
|
|
|
from the remote but are pointing at commit-ish that are
|
2015-02-16 06:16:19 +00:00
|
|
|
reachable from the refs being pushed. This can also be specified
|
2016-06-08 17:23:16 +00:00
|
|
|
with configuration variable `push.followTags`. For more
|
|
|
|
information, see `push.followTags` in linkgit:git-config[1].
|
2015-02-16 06:16:19 +00:00
|
|
|
|
2015-08-19 15:26:46 +00:00
|
|
|
--[no-]signed::
|
Doc/git-{push,send-pack}: correct --sign= to --signed=
Since we're about to touch the behavior of --signed=, do this as a
preparatory step.
The documentation mentions --sign=, and it works. But that's just
because it's an unambiguous abbreviation of --signed, which is how it is
actually implemented. This was added in commit 30261094 ("push: support
signing pushes iff the server supports it", 2015-08-19). Back when that
series was developed [1] [2], there were suggestions about both --sign=
and --signed=. The final implementation settled on --signed=, but some
of the documentation and commit messages ended up using --sign=.
The option is referred to as --signed= in Documentation/config.txt
(under push.gpgSign).
One could argue that we have promised --sign for two years now, so we
should implement it as an alias for --signed. (Then we might also
deprecate the latter, something which was considered already then.) That
would be a slightly more intrusive change.
This minor issue would only be a problem once we want to implement some
other option --signfoo, but the earlier we do this step, the better.
[1] v1-thread:
https://public-inbox.org/git/1439492451-11233-1-git-send-email-dborowitz@google.com/T/#u
[2] v2-thread:
https://public-inbox.org/git/1439998007-28719-1-git-send-email-dborowitz@google.com/T/#m6533a6c4707a30b0d81e86169ff8559460cbf6eb
Signed-off-by: Martin Ågren <martin.agren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-08-07 18:20:45 +00:00
|
|
|
--signed=(true|false|if-asked)::
|
push: the beginning of "git push --signed"
While signed tags and commits assert that the objects thusly signed
came from you, who signed these objects, there is not a good way to
assert that you wanted to have a particular object at the tip of a
particular branch. My signing v2.0.1 tag only means I want to call
the version v2.0.1, and it does not mean I want to push it out to my
'master' branch---it is likely that I only want it in 'maint', so
the signature on the object alone is insufficient.
The only assurance to you that 'maint' points at what I wanted to
place there comes from your trust on the hosting site and my
authentication with it, which cannot easily audited later.
Introduce a mechanism that allows you to sign a "push certificate"
(for the lack of better name) every time you push, asserting that
what object you are pushing to update which ref that used to point
at what other object. Think of it as a cryptographic protection for
ref updates, similar to signed tags/commits but working on an
orthogonal axis.
The basic flow based on this mechanism goes like this:
1. You push out your work with "git push --signed".
2. The sending side learns where the remote refs are as usual,
together with what protocol extension the receiving end
supports. If the receiving end does not advertise the protocol
extension "push-cert", an attempt to "git push --signed" fails.
Otherwise, a text file, that looks like the following, is
prepared in core:
certificate version 0.1
pusher Junio C Hamano <gitster@pobox.com> 1315427886 -0700
7339ca65... 21580ecb... refs/heads/master
3793ac56... 12850bec... refs/heads/next
The file begins with a few header lines, which may grow as we
gain more experience. The 'pusher' header records the name of
the signer (the value of user.signingkey configuration variable,
falling back to GIT_COMMITTER_{NAME|EMAIL}) and the time of the
certificate generation. After the header, a blank line follows,
followed by a copy of the protocol message lines.
Each line shows the old and the new object name at the tip of
the ref this push tries to update, in the way identical to how
the underlying "git push" protocol exchange tells the ref
updates to the receiving end (by recording the "old" object
name, the push certificate also protects against replaying). It
is expected that new command packet types other than the
old-new-refname kind will be included in push certificate in the
same way as would appear in the plain vanilla command packets in
unsigned pushes.
The user then is asked to sign this push certificate using GPG,
formatted in a way similar to how signed tag objects are signed,
and the result is sent to the other side (i.e. receive-pack).
In the protocol exchange, this step comes immediately before the
sender tells what the result of the push should be, which in
turn comes before it sends the pack data.
3. When the receiving end sees a push certificate, the certificate
is written out as a blob. The pre-receive hook can learn about
the certificate by checking GIT_PUSH_CERT environment variable,
which, if present, tells the object name of this blob, and make
the decision to allow or reject this push. Additionally, the
post-receive hook can also look at the certificate, which may be
a good place to log all the received certificates for later
audits.
Because a push certificate carry the same information as the usual
command packets in the protocol exchange, we can omit the latter
when a push certificate is in use and reduce the protocol overhead.
This however is not included in this patch to make it easier to
review (in other words, the series at this step should never be
released without the remainder of the series, as it implements an
interim protocol that will be incompatible with the final one).
As such, the documentation update for the protocol is left out of
this step.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-09-12 18:17:07 +00:00
|
|
|
GPG-sign the push request to update refs on the receiving
|
|
|
|
side, to allow it to be checked by the hooks and/or be
|
2015-08-19 15:26:46 +00:00
|
|
|
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.
|
push: the beginning of "git push --signed"
While signed tags and commits assert that the objects thusly signed
came from you, who signed these objects, there is not a good way to
assert that you wanted to have a particular object at the tip of a
particular branch. My signing v2.0.1 tag only means I want to call
the version v2.0.1, and it does not mean I want to push it out to my
'master' branch---it is likely that I only want it in 'maint', so
the signature on the object alone is insufficient.
The only assurance to you that 'maint' points at what I wanted to
place there comes from your trust on the hosting site and my
authentication with it, which cannot easily audited later.
Introduce a mechanism that allows you to sign a "push certificate"
(for the lack of better name) every time you push, asserting that
what object you are pushing to update which ref that used to point
at what other object. Think of it as a cryptographic protection for
ref updates, similar to signed tags/commits but working on an
orthogonal axis.
The basic flow based on this mechanism goes like this:
1. You push out your work with "git push --signed".
2. The sending side learns where the remote refs are as usual,
together with what protocol extension the receiving end
supports. If the receiving end does not advertise the protocol
extension "push-cert", an attempt to "git push --signed" fails.
Otherwise, a text file, that looks like the following, is
prepared in core:
certificate version 0.1
pusher Junio C Hamano <gitster@pobox.com> 1315427886 -0700
7339ca65... 21580ecb... refs/heads/master
3793ac56... 12850bec... refs/heads/next
The file begins with a few header lines, which may grow as we
gain more experience. The 'pusher' header records the name of
the signer (the value of user.signingkey configuration variable,
falling back to GIT_COMMITTER_{NAME|EMAIL}) and the time of the
certificate generation. After the header, a blank line follows,
followed by a copy of the protocol message lines.
Each line shows the old and the new object name at the tip of
the ref this push tries to update, in the way identical to how
the underlying "git push" protocol exchange tells the ref
updates to the receiving end (by recording the "old" object
name, the push certificate also protects against replaying). It
is expected that new command packet types other than the
old-new-refname kind will be included in push certificate in the
same way as would appear in the plain vanilla command packets in
unsigned pushes.
The user then is asked to sign this push certificate using GPG,
formatted in a way similar to how signed tag objects are signed,
and the result is sent to the other side (i.e. receive-pack).
In the protocol exchange, this step comes immediately before the
sender tells what the result of the push should be, which in
turn comes before it sends the pack data.
3. When the receiving end sees a push certificate, the certificate
is written out as a blob. The pre-receive hook can learn about
the certificate by checking GIT_PUSH_CERT environment variable,
which, if present, tells the object name of this blob, and make
the decision to allow or reject this push. Additionally, the
post-receive hook can also look at the certificate, which may be
a good place to log all the received certificates for later
audits.
Because a push certificate carry the same information as the usual
command packets in the protocol exchange, we can omit the latter
when a push certificate is in use and reduce the protocol overhead.
This however is not included in this patch to make it easier to
review (in other words, the series at this step should never be
released without the remainder of the series, as it implements an
interim protocol that will be incompatible with the final one).
As such, the documentation update for the protocol is left out of
this step.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-09-12 18:17:07 +00:00
|
|
|
|
2015-01-08 03:23:23 +00:00
|
|
|
--[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.
|
|
|
|
|
2017-10-23 11:44:49 +00:00
|
|
|
-o <option>::
|
|
|
|
--push-option=<option>::
|
2016-07-14 21:49:47 +00:00
|
|
|
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.
|
2017-10-23 11:44:49 +00:00
|
|
|
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.
|
2016-07-14 21:49:47 +00:00
|
|
|
|
2008-06-08 01:36:09 +00:00
|
|
|
--receive-pack=<git-receive-pack>::
|
2009-01-12 03:05:54 +00:00
|
|
|
--exec=<git-receive-pack>::
|
2008-07-03 05:41:41 +00:00
|
|
|
Path to the 'git-receive-pack' program on the remote
|
2007-01-16 15:02:02 +00:00
|
|
|
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.
|
|
|
|
|
remote.c: add command line option parser for "--force-with-lease"
Update "git push" and "git send-pack" to parse this commnd line
option.
The intended sematics is:
* "--force-with-lease" 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 some reasonable
default, unless otherwise specified;
* "--force-with-lease=refname", without specifying the expected
value, will protect that refname, if it is going to be updated,
by requiring its current value to be the same as some reasonable
default.
* "--force-with-lease=refname:value" will protect that refname, if
it is going to be updated, by requiring its current value to be
the same as the specified value; and
* "--no-force-with-lease" will cancel all the previous --force-with-lease on the
command line.
For now, "some reasonable default" is tentatively defined as "the
value of the remote-tracking branch we have for the ref of the
remote being updated", and it is an error if we do not have such a
remote-tracking branch. But this is known to be fragile, its use is
not yet recommended, and hopefully we will find more reasonable
default as we gain experience with this feature. The manual marks
the feature as experimental unless the expected value is specified
explicitly for this reason.
Because the command line options are parsed _before_ we know which
remote we are pushing to, there needs further processing to the
parsed data after we instantiate the transport object to:
* expand "refname" given by the user to a full refname to be
matched with the list of "struct ref" used in match_push_refs()
and set_ref_status_for_push(); and
* learning the actual local ref that is the remote-tracking branch
for the specified remote ref.
Further, some processing need to be deferred until we find the set
of remote refs and match_push_refs() returns in order to find the
ones that need to be checked after explicit ones have been processed
for "--force-with-lease" (no specific details).
These post-processing will be the topic of the next patch.
This option was originally called "cas" (for "compare and swap"),
the name which nobody liked because it was too technical. The
second attempt called it "lockref" (because it is conceptually like
pushing after taking a lock) but the word "lock" was hated because
it implied that it may reject push by others, which is not the way
this option works. This round calls it "force-with-lease". You
assume you took the lease on the ref when you fetched to decide what
the rebased history should be, and you can push back only if the
lease has not been broken.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-07-08 22:34:36 +00:00
|
|
|
--[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 to overwrite it.
|
|
|
|
+
|
2015-03-26 15:15:09 +00:00
|
|
|
This option overrides this restriction if the current value of the
|
|
|
|
remote ref is the expected value. "git push" fails otherwise.
|
remote.c: add command line option parser for "--force-with-lease"
Update "git push" and "git send-pack" to parse this commnd line
option.
The intended sematics is:
* "--force-with-lease" 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 some reasonable
default, unless otherwise specified;
* "--force-with-lease=refname", without specifying the expected
value, will protect that refname, if it is going to be updated,
by requiring its current value to be the same as some reasonable
default.
* "--force-with-lease=refname:value" will protect that refname, if
it is going to be updated, by requiring its current value to be
the same as the specified value; and
* "--no-force-with-lease" will cancel all the previous --force-with-lease on the
command line.
For now, "some reasonable default" is tentatively defined as "the
value of the remote-tracking branch we have for the ref of the
remote being updated", and it is an error if we do not have such a
remote-tracking branch. But this is known to be fragile, its use is
not yet recommended, and hopefully we will find more reasonable
default as we gain experience with this feature. The manual marks
the feature as experimental unless the expected value is specified
explicitly for this reason.
Because the command line options are parsed _before_ we know which
remote we are pushing to, there needs further processing to the
parsed data after we instantiate the transport object to:
* expand "refname" given by the user to a full refname to be
matched with the list of "struct ref" used in match_push_refs()
and set_ref_status_for_push(); and
* learning the actual local ref that is the remote-tracking branch
for the specified remote ref.
Further, some processing need to be deferred until we find the set
of remote refs and match_push_refs() returns in order to find the
ones that need to be checked after explicit ones have been processed
for "--force-with-lease" (no specific details).
These post-processing will be the topic of the next patch.
This option was originally called "cas" (for "compare and swap"),
the name which nobody liked because it was too technical. The
second attempt called it "lockref" (because it is conceptually like
pushing after taking a lock) but the word "lock" was hated because
it implied that it may reject push by others, which is not the way
this option works. This round calls it "force-with-lease". You
assume you took the lease on the ref when you fetched to decide what
the rebased history should be, and you can push back only if the
lease has not been broken.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-07-08 22:34:36 +00:00
|
|
|
+
|
|
|
|
Imagine that you have to rebase what you have already published.
|
|
|
|
You will have to bypass the "must fast-forward" rule in order to
|
|
|
|
replace the history you originally published with the rebased history.
|
|
|
|
If somebody else built on top of your original history while you are
|
2021-06-15 14:11:09 +00:00
|
|
|
rebasing, the tip of the branch at the remote may advance with their
|
|
|
|
commit, and blindly pushing with `--force` will lose their work.
|
remote.c: add command line option parser for "--force-with-lease"
Update "git push" and "git send-pack" to parse this commnd line
option.
The intended sematics is:
* "--force-with-lease" 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 some reasonable
default, unless otherwise specified;
* "--force-with-lease=refname", without specifying the expected
value, will protect that refname, if it is going to be updated,
by requiring its current value to be the same as some reasonable
default.
* "--force-with-lease=refname:value" will protect that refname, if
it is going to be updated, by requiring its current value to be
the same as the specified value; and
* "--no-force-with-lease" will cancel all the previous --force-with-lease on the
command line.
For now, "some reasonable default" is tentatively defined as "the
value of the remote-tracking branch we have for the ref of the
remote being updated", and it is an error if we do not have such a
remote-tracking branch. But this is known to be fragile, its use is
not yet recommended, and hopefully we will find more reasonable
default as we gain experience with this feature. The manual marks
the feature as experimental unless the expected value is specified
explicitly for this reason.
Because the command line options are parsed _before_ we know which
remote we are pushing to, there needs further processing to the
parsed data after we instantiate the transport object to:
* expand "refname" given by the user to a full refname to be
matched with the list of "struct ref" used in match_push_refs()
and set_ref_status_for_push(); and
* learning the actual local ref that is the remote-tracking branch
for the specified remote ref.
Further, some processing need to be deferred until we find the set
of remote refs and match_push_refs() returns in order to find the
ones that need to be checked after explicit ones have been processed
for "--force-with-lease" (no specific details).
These post-processing will be the topic of the next patch.
This option was originally called "cas" (for "compare and swap"),
the name which nobody liked because it was too technical. The
second attempt called it "lockref" (because it is conceptually like
pushing after taking a lock) but the word "lock" was hated because
it implied that it may reject push by others, which is not the way
this option works. This round calls it "force-with-lease". You
assume you took the lease on the ref when you fetched to decide what
the rebased history should be, and you can push back only if the
lease has not been broken.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-07-08 22:34:36 +00:00
|
|
|
+
|
|
|
|
This option allows you to say that you expect the history you are
|
|
|
|
updating is what you rebased and want to replace. If the remote ref
|
|
|
|
still points at the commit you specified, you can be sure that no
|
2015-03-26 15:15:09 +00:00
|
|
|
other people did anything to the ref. It is like taking a "lease" on
|
|
|
|
the ref without explicitly locking it, and the remote ref is updated
|
|
|
|
only if the "lease" is still valid.
|
remote.c: add command line option parser for "--force-with-lease"
Update "git push" and "git send-pack" to parse this commnd line
option.
The intended sematics is:
* "--force-with-lease" 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 some reasonable
default, unless otherwise specified;
* "--force-with-lease=refname", without specifying the expected
value, will protect that refname, if it is going to be updated,
by requiring its current value to be the same as some reasonable
default.
* "--force-with-lease=refname:value" will protect that refname, if
it is going to be updated, by requiring its current value to be
the same as the specified value; and
* "--no-force-with-lease" will cancel all the previous --force-with-lease on the
command line.
For now, "some reasonable default" is tentatively defined as "the
value of the remote-tracking branch we have for the ref of the
remote being updated", and it is an error if we do not have such a
remote-tracking branch. But this is known to be fragile, its use is
not yet recommended, and hopefully we will find more reasonable
default as we gain experience with this feature. The manual marks
the feature as experimental unless the expected value is specified
explicitly for this reason.
Because the command line options are parsed _before_ we know which
remote we are pushing to, there needs further processing to the
parsed data after we instantiate the transport object to:
* expand "refname" given by the user to a full refname to be
matched with the list of "struct ref" used in match_push_refs()
and set_ref_status_for_push(); and
* learning the actual local ref that is the remote-tracking branch
for the specified remote ref.
Further, some processing need to be deferred until we find the set
of remote refs and match_push_refs() returns in order to find the
ones that need to be checked after explicit ones have been processed
for "--force-with-lease" (no specific details).
These post-processing will be the topic of the next patch.
This option was originally called "cas" (for "compare and swap"),
the name which nobody liked because it was too technical. The
second attempt called it "lockref" (because it is conceptually like
pushing after taking a lock) but the word "lock" was hated because
it implied that it may reject push by others, which is not the way
this option works. This round calls it "force-with-lease". You
assume you took the lease on the ref when you fetched to decide what
the rebased history should be, and you can push back only if the
lease has not been broken.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-07-08 22:34:36 +00:00
|
|
|
+
|
|
|
|
`--force-with-lease` 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
|
2015-03-26 15:15:09 +00:00
|
|
|
for them.
|
remote.c: add command line option parser for "--force-with-lease"
Update "git push" and "git send-pack" to parse this commnd line
option.
The intended sematics is:
* "--force-with-lease" 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 some reasonable
default, unless otherwise specified;
* "--force-with-lease=refname", without specifying the expected
value, will protect that refname, if it is going to be updated,
by requiring its current value to be the same as some reasonable
default.
* "--force-with-lease=refname:value" will protect that refname, if
it is going to be updated, by requiring its current value to be
the same as the specified value; and
* "--no-force-with-lease" will cancel all the previous --force-with-lease on the
command line.
For now, "some reasonable default" is tentatively defined as "the
value of the remote-tracking branch we have for the ref of the
remote being updated", and it is an error if we do not have such a
remote-tracking branch. But this is known to be fragile, its use is
not yet recommended, and hopefully we will find more reasonable
default as we gain experience with this feature. The manual marks
the feature as experimental unless the expected value is specified
explicitly for this reason.
Because the command line options are parsed _before_ we know which
remote we are pushing to, there needs further processing to the
parsed data after we instantiate the transport object to:
* expand "refname" given by the user to a full refname to be
matched with the list of "struct ref" used in match_push_refs()
and set_ref_status_for_push(); and
* learning the actual local ref that is the remote-tracking branch
for the specified remote ref.
Further, some processing need to be deferred until we find the set
of remote refs and match_push_refs() returns in order to find the
ones that need to be checked after explicit ones have been processed
for "--force-with-lease" (no specific details).
These post-processing will be the topic of the next patch.
This option was originally called "cas" (for "compare and swap"),
the name which nobody liked because it was too technical. The
second attempt called it "lockref" (because it is conceptually like
pushing after taking a lock) but the word "lock" was hated because
it implied that it may reject push by others, which is not the way
this option works. This round calls it "force-with-lease". You
assume you took the lease on the ref when you fetched to decide what
the rebased history should be, and you can push back only if the
lease has not been broken.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-07-08 22:34:36 +00:00
|
|
|
+
|
|
|
|
`--force-with-lease=<refname>`, 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.
|
|
|
|
+
|
|
|
|
`--force-with-lease=<refname>:<expect>` will protect the named ref (alone),
|
|
|
|
if it is going to be updated, by requiring its current value to be
|
2016-07-25 21:59:55 +00:00
|
|
|
the same as the specified value `<expect>` (which is allowed to be
|
remote.c: add command line option parser for "--force-with-lease"
Update "git push" and "git send-pack" to parse this commnd line
option.
The intended sematics is:
* "--force-with-lease" 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 some reasonable
default, unless otherwise specified;
* "--force-with-lease=refname", without specifying the expected
value, will protect that refname, if it is going to be updated,
by requiring its current value to be the same as some reasonable
default.
* "--force-with-lease=refname:value" will protect that refname, if
it is going to be updated, by requiring its current value to be
the same as the specified value; and
* "--no-force-with-lease" will cancel all the previous --force-with-lease on the
command line.
For now, "some reasonable default" is tentatively defined as "the
value of the remote-tracking branch we have for the ref of the
remote being updated", and it is an error if we do not have such a
remote-tracking branch. But this is known to be fragile, its use is
not yet recommended, and hopefully we will find more reasonable
default as we gain experience with this feature. The manual marks
the feature as experimental unless the expected value is specified
explicitly for this reason.
Because the command line options are parsed _before_ we know which
remote we are pushing to, there needs further processing to the
parsed data after we instantiate the transport object to:
* expand "refname" given by the user to a full refname to be
matched with the list of "struct ref" used in match_push_refs()
and set_ref_status_for_push(); and
* learning the actual local ref that is the remote-tracking branch
for the specified remote ref.
Further, some processing need to be deferred until we find the set
of remote refs and match_push_refs() returns in order to find the
ones that need to be checked after explicit ones have been processed
for "--force-with-lease" (no specific details).
These post-processing will be the topic of the next patch.
This option was originally called "cas" (for "compare and swap"),
the name which nobody liked because it was too technical. The
second attempt called it "lockref" (because it is conceptually like
pushing after taking a lock) but the word "lock" was hated because
it implied that it may reject push by others, which is not the way
this option works. This round calls it "force-with-lease". You
assume you took the lease on the ref when you fetched to decide what
the rebased history should be, and you can push back only if the
lease has not been broken.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-07-08 22:34:36 +00:00
|
|
|
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
|
2016-07-26 20:44:44 +00:00
|
|
|
this form is used). If `<expect>` is the empty string, then the named ref
|
|
|
|
must not already exist.
|
remote.c: add command line option parser for "--force-with-lease"
Update "git push" and "git send-pack" to parse this commnd line
option.
The intended sematics is:
* "--force-with-lease" 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 some reasonable
default, unless otherwise specified;
* "--force-with-lease=refname", without specifying the expected
value, will protect that refname, if it is going to be updated,
by requiring its current value to be the same as some reasonable
default.
* "--force-with-lease=refname:value" will protect that refname, if
it is going to be updated, by requiring its current value to be
the same as the specified value; and
* "--no-force-with-lease" will cancel all the previous --force-with-lease on the
command line.
For now, "some reasonable default" is tentatively defined as "the
value of the remote-tracking branch we have for the ref of the
remote being updated", and it is an error if we do not have such a
remote-tracking branch. But this is known to be fragile, its use is
not yet recommended, and hopefully we will find more reasonable
default as we gain experience with this feature. The manual marks
the feature as experimental unless the expected value is specified
explicitly for this reason.
Because the command line options are parsed _before_ we know which
remote we are pushing to, there needs further processing to the
parsed data after we instantiate the transport object to:
* expand "refname" given by the user to a full refname to be
matched with the list of "struct ref" used in match_push_refs()
and set_ref_status_for_push(); and
* learning the actual local ref that is the remote-tracking branch
for the specified remote ref.
Further, some processing need to be deferred until we find the set
of remote refs and match_push_refs() returns in order to find the
ones that need to be checked after explicit ones have been processed
for "--force-with-lease" (no specific details).
These post-processing will be the topic of the next patch.
This option was originally called "cas" (for "compare and swap"),
the name which nobody liked because it was too technical. The
second attempt called it "lockref" (because it is conceptually like
pushing after taking a lock) but the word "lock" was hated because
it implied that it may reject push by others, which is not the way
this option works. This round calls it "force-with-lease". You
assume you took the lease on the ref when you fetched to decide what
the rebased history should be, and you can push back only if the
lease has not been broken.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-07-08 22:34:36 +00:00
|
|
|
+
|
|
|
|
Note that all forms other than `--force-with-lease=<refname>:<expect>`
|
|
|
|
that specifies the expected current value of the ref explicitly are
|
|
|
|
still experimental and their semantics may change as we gain experience
|
|
|
|
with this feature.
|
|
|
|
+
|
|
|
|
"--no-force-with-lease" will cancel all the previous --force-with-lease on the
|
|
|
|
command line.
|
2017-04-19 09:22:03 +00:00
|
|
|
+
|
|
|
|
A general note on safety: supplying this option without an expected
|
|
|
|
value, i.e. as `--force-with-lease` or `--force-with-lease=<refname>`
|
|
|
|
interacts very badly with anything that implicitly runs `git fetch` on
|
|
|
|
the remote to be pushed to in the background, e.g. `git fetch origin`
|
|
|
|
on your repository in a cronjob.
|
|
|
|
+
|
|
|
|
The protection it offers over `--force` is ensuring that subsequent
|
|
|
|
changes your work wasn't based on aren't clobbered, but this is
|
|
|
|
trivially defeated if some background process is updating refs in the
|
|
|
|
background. We don't have anything except the remote tracking info to
|
|
|
|
go by as a heuristic for refs you're expected to have seen & are
|
|
|
|
willing to clobber.
|
|
|
|
+
|
|
|
|
If your editor or some other system is running `git fetch` in the
|
|
|
|
background for you a way to mitigate this is to simply set up another
|
|
|
|
remote:
|
|
|
|
+
|
|
|
|
git remote add origin-push $(git config remote.origin.url)
|
|
|
|
git fetch origin-push
|
|
|
|
+
|
|
|
|
Now when the background process runs `git fetch origin` the references
|
|
|
|
on `origin-push` won't be updated, and thus commands like:
|
|
|
|
+
|
|
|
|
git push --force-with-lease origin-push
|
|
|
|
+
|
|
|
|
Will fail unless you manually run `git fetch origin-push`. This method
|
|
|
|
is of course entirely defeated by something that runs `git fetch
|
|
|
|
--all`, in that case you'd need to either disable it or do something
|
|
|
|
more tedious like:
|
|
|
|
+
|
|
|
|
git fetch # update 'master' from remote
|
|
|
|
git tag base master # mark our base point
|
|
|
|
git rebase -i master # rewrite some commits
|
|
|
|
git push --force-with-lease=master:base master:master
|
|
|
|
+
|
|
|
|
I.e. create a `base` tag for versions of the upstream code that you've
|
|
|
|
seen and are willing to overwrite, then rewrite history, and finally
|
|
|
|
force push changes to `master` if the remote version is still at
|
|
|
|
`base`, regardless of what your local `remotes/origin/master` has been
|
|
|
|
updated to in the background.
|
2020-10-03 12:10:46 +00:00
|
|
|
+
|
|
|
|
Alternatively, specifying `--force-if-includes` as an ancillary option
|
|
|
|
along with `--force-with-lease[=<refname>]` (i.e., without saying what
|
|
|
|
exact commit the ref on the remote side must be pointing at, or which
|
|
|
|
refs on the remote side are being protected) at the time of "push" will
|
|
|
|
verify if updates from the remote-tracking refs that may have been
|
|
|
|
implicitly updated in the background are integrated locally before
|
|
|
|
allowing a forced update.
|
remote.c: add command line option parser for "--force-with-lease"
Update "git push" and "git send-pack" to parse this commnd line
option.
The intended sematics is:
* "--force-with-lease" 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 some reasonable
default, unless otherwise specified;
* "--force-with-lease=refname", without specifying the expected
value, will protect that refname, if it is going to be updated,
by requiring its current value to be the same as some reasonable
default.
* "--force-with-lease=refname:value" will protect that refname, if
it is going to be updated, by requiring its current value to be
the same as the specified value; and
* "--no-force-with-lease" will cancel all the previous --force-with-lease on the
command line.
For now, "some reasonable default" is tentatively defined as "the
value of the remote-tracking branch we have for the ref of the
remote being updated", and it is an error if we do not have such a
remote-tracking branch. But this is known to be fragile, its use is
not yet recommended, and hopefully we will find more reasonable
default as we gain experience with this feature. The manual marks
the feature as experimental unless the expected value is specified
explicitly for this reason.
Because the command line options are parsed _before_ we know which
remote we are pushing to, there needs further processing to the
parsed data after we instantiate the transport object to:
* expand "refname" given by the user to a full refname to be
matched with the list of "struct ref" used in match_push_refs()
and set_ref_status_for_push(); and
* learning the actual local ref that is the remote-tracking branch
for the specified remote ref.
Further, some processing need to be deferred until we find the set
of remote refs and match_push_refs() returns in order to find the
ones that need to be checked after explicit ones have been processed
for "--force-with-lease" (no specific details).
These post-processing will be the topic of the next patch.
This option was originally called "cas" (for "compare and swap"),
the name which nobody liked because it was too technical. The
second attempt called it "lockref" (because it is conceptually like
pushing after taking a lock) but the word "lock" was hated because
it implied that it may reject push by others, which is not the way
this option works. This round calls it "force-with-lease". You
assume you took the lease on the ref when you fetched to decide what
the rebased history should be, and you can push back only if the
lease has not been broken.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-07-08 22:34:36 +00:00
|
|
|
|
2008-06-08 01:36:09 +00:00
|
|
|
-f::
|
|
|
|
--force::
|
2006-01-30 01:40:50 +00:00
|
|
|
Usually, the command refuses to update a remote ref that is
|
2007-08-05 05:22:15 +00:00
|
|
|
not an ancestor of the local ref used to overwrite it.
|
remote.c: add command line option parser for "--force-with-lease"
Update "git push" and "git send-pack" to parse this commnd line
option.
The intended sematics is:
* "--force-with-lease" 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 some reasonable
default, unless otherwise specified;
* "--force-with-lease=refname", without specifying the expected
value, will protect that refname, if it is going to be updated,
by requiring its current value to be the same as some reasonable
default.
* "--force-with-lease=refname:value" will protect that refname, if
it is going to be updated, by requiring its current value to be
the same as the specified value; and
* "--no-force-with-lease" will cancel all the previous --force-with-lease on the
command line.
For now, "some reasonable default" is tentatively defined as "the
value of the remote-tracking branch we have for the ref of the
remote being updated", and it is an error if we do not have such a
remote-tracking branch. But this is known to be fragile, its use is
not yet recommended, and hopefully we will find more reasonable
default as we gain experience with this feature. The manual marks
the feature as experimental unless the expected value is specified
explicitly for this reason.
Because the command line options are parsed _before_ we know which
remote we are pushing to, there needs further processing to the
parsed data after we instantiate the transport object to:
* expand "refname" given by the user to a full refname to be
matched with the list of "struct ref" used in match_push_refs()
and set_ref_status_for_push(); and
* learning the actual local ref that is the remote-tracking branch
for the specified remote ref.
Further, some processing need to be deferred until we find the set
of remote refs and match_push_refs() returns in order to find the
ones that need to be checked after explicit ones have been processed
for "--force-with-lease" (no specific details).
These post-processing will be the topic of the next patch.
This option was originally called "cas" (for "compare and swap"),
the name which nobody liked because it was too technical. The
second attempt called it "lockref" (because it is conceptually like
pushing after taking a lock) but the word "lock" was hated because
it implied that it may reject push by others, which is not the way
this option works. This round calls it "force-with-lease". You
assume you took the lease on the ref when you fetched to decide what
the rebased history should be, and you can push back only if the
lease has not been broken.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-07-08 22:34:36 +00:00
|
|
|
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.
|
|
|
|
+
|
|
|
|
This flag disables these checks, and can cause the remote repository
|
|
|
|
to lose commits; use it with care.
|
|
|
|
+
|
|
|
|
Note that `--force` applies to all the refs that are pushed, hence
|
|
|
|
using it with `push.default` set to `matching` or with multiple push
|
|
|
|
destinations configured with `remote.*.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.
|
2005-08-23 08:49:47 +00:00
|
|
|
|
2020-10-03 12:10:46 +00:00
|
|
|
--[no-]force-if-includes::
|
|
|
|
Force an update only if the tip of the remote-tracking ref
|
|
|
|
has been integrated locally.
|
|
|
|
+
|
|
|
|
This option enables a check that verifies if the tip of the
|
|
|
|
remote-tracking ref is reachable from one of the "reflog" entries of
|
|
|
|
the local branch based in it for a rewrite. The check ensures that any
|
|
|
|
updates from the remote have been incorporated locally by rejecting the
|
|
|
|
forced update if that is not the case.
|
|
|
|
+
|
|
|
|
If the option is passed without specifying `--force-with-lease`, or
|
|
|
|
specified along with `--force-with-lease=<refname>:<expect>`, it is
|
|
|
|
a "no-op".
|
|
|
|
+
|
|
|
|
Specifying `--no-force-if-includes` disables this behavior.
|
|
|
|
|
2008-10-07 14:26:20 +00:00
|
|
|
--repo=<repository>::
|
2015-01-27 12:35:53 +00:00
|
|
|
This option is equivalent to the <repository> argument. If both
|
|
|
|
are specified, the command-line argument takes precedence.
|
2007-01-16 19:46:03 +00:00
|
|
|
|
2010-01-23 22:18:23 +00:00
|
|
|
-u::
|
|
|
|
--set-upstream::
|
|
|
|
For every branch that is up to date or successfully pushed, add
|
|
|
|
upstream (tracking) reference, used by argument-less
|
|
|
|
linkgit:git-pull[1] and other commands. For more information,
|
2016-06-08 17:23:16 +00:00
|
|
|
see `branch.<name>.merge` in linkgit:git-config[1].
|
2010-01-23 22:18:23 +00:00
|
|
|
|
2013-05-09 01:16:55 +00:00
|
|
|
--[no-]thin::
|
2010-02-18 09:10:28 +00:00
|
|
|
These options are passed to linkgit: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
|
2018-04-17 19:15:26 +00:00
|
|
|
`--thin`.
|
2007-01-16 19:46:03 +00:00
|
|
|
|
2009-10-19 04:01:19 +00:00
|
|
|
-q::
|
|
|
|
--quiet::
|
|
|
|
Suppress all output, including the listing of updated refs,
|
2010-02-24 12:50:27 +00:00
|
|
|
unless an error occurs. Progress is not reported to the standard
|
|
|
|
error stream.
|
2009-10-19 04:01:19 +00:00
|
|
|
|
2008-06-08 01:36:09 +00:00
|
|
|
-v::
|
|
|
|
--verbose::
|
2007-01-16 19:46:03 +00:00
|
|
|
Run verbosely.
|
|
|
|
|
2010-02-24 12:50:27 +00:00
|
|
|
--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.
|
2009-10-19 04:01:19 +00:00
|
|
|
|
2015-11-17 11:05:56 +00:00
|
|
|
--no-recurse-submodules::
|
2017-02-01 23:07:52 +00:00
|
|
|
--recurse-submodules=check|on-demand|only|no::
|
2015-11-17 11:05:56 +00:00
|
|
|
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
|
2017-02-01 23:07:52 +00:00
|
|
|
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.
|
2011-08-19 22:08:47 +00:00
|
|
|
|
2013-05-23 13:34:11 +00:00
|
|
|
--[no-]verify::
|
|
|
|
Toggle the pre-push hook (see linkgit:githooks[5]). The
|
2015-05-13 05:01:38 +00:00
|
|
|
default is --verify, giving the hook a chance to prevent the
|
|
|
|
push. With --no-verify, the hook is bypassed completely.
|
2013-05-23 13:34:11 +00:00
|
|
|
|
2016-02-03 04:09:14 +00:00
|
|
|
-4::
|
|
|
|
--ipv4::
|
|
|
|
Use IPv4 addresses only, ignoring IPv6 addresses.
|
|
|
|
|
|
|
|
-6::
|
|
|
|
--ipv6::
|
|
|
|
Use IPv6 addresses only, ignoring IPv4 addresses.
|
2011-08-19 22:08:47 +00:00
|
|
|
|
2007-07-04 22:21:36 +00:00
|
|
|
include::urls-remotes.txt[]
|
2005-12-05 08:32:01 +00:00
|
|
|
|
2008-02-19 16:26:45 +00:00
|
|
|
OUTPUT
|
|
|
|
------
|
|
|
|
|
|
|
|
The output of "git push" depends on the transport method used; this
|
2013-01-21 19:17:53 +00:00
|
|
|
section describes the output when pushing over the Git protocol (either
|
2008-02-19 16:26:45 +00:00
|
|
|
locally or via ssh).
|
|
|
|
|
|
|
|
The status of the push is output in tabular form, with each line
|
|
|
|
representing the status of a single ref. Each line is of the form:
|
|
|
|
|
|
|
|
-------------------------------
|
|
|
|
<flag> <summary> <from> -> <to> (<reason>)
|
|
|
|
-------------------------------
|
|
|
|
|
2009-06-23 01:10:01 +00:00
|
|
|
If --porcelain is used, then each line of the output is of the form:
|
|
|
|
|
|
|
|
-------------------------------
|
|
|
|
<flag> \t <from>:<to> \t <summary> (<reason>)
|
|
|
|
-------------------------------
|
|
|
|
|
2010-02-09 00:45:21 +00:00
|
|
|
The status of up-to-date refs is shown only if --porcelain or --verbose
|
|
|
|
option is used.
|
|
|
|
|
2008-02-19 16:26:45 +00:00
|
|
|
flag::
|
2010-02-09 00:45:21 +00:00
|
|
|
A single character indicating the status of the ref:
|
|
|
|
(space);; for a successfully pushed fast-forward;
|
docs: stop using asciidoc no-inline-literal
In asciidoc 7, backticks like `foo` produced a typographic
effect, but did not otherwise affect the syntax. In asciidoc
8, backticks introduce an "inline literal" inside which markup
is not interpreted. To keep compatibility with existing
documents, asciidoc 8 has a "no-inline-literal" attribute to
keep the old behavior. We enabled this so that the
documentation could be built on either version.
It has been several years now, and asciidoc 7 is no longer
in wide use. We can now decide whether or not we want
inline literals on their own merits, which are:
1. The source is much easier to read when the literal
contains punctuation. You can use `master~1` instead
of `master{tilde}1`.
2. They are less error-prone. Because of point (1), we
tend to make mistakes and forget the extra layer of
quoting.
This patch removes the no-inline-literal attribute from the
Makefile and converts every use of backticks in the
documentation to an inline literal (they must be cleaned up,
or the example above would literally show "{tilde}" in the
output).
Problematic sites were found by grepping for '`.*[{\\]' and
examined and fixed manually. The results were then verified
by comparing the output of "html2text" on the set of
generated html pages. Doing so revealed that in addition to
making the source more readable, this patch fixes several
formatting bugs:
- HTML rendering used the ellipsis character instead of
literal "..." in code examples (like "git log A...B")
- some code examples used the right-arrow character
instead of '->' because they failed to quote
- api-config.txt did not quote tilde, and the resulting
HTML contained a bogus snippet like:
<tt><sub></tt> foo <tt></sub>bar</tt>
which caused some parsers to choke and omit whole
sections of the page.
- git-commit.txt confused ``foo`` (backticks inside a
literal) with ``foo'' (matched double-quotes)
- mentions of `A U Thor <author@example.com>` used to
erroneously auto-generate a mailto footnote for
author@example.com
- the description of --word-diff=plain incorrectly showed
the output as "[-removed-] and {added}", not "{+added+}".
- using "prime" notation like:
commit `C` and its replacement `C'`
confused asciidoc into thinking that everything between
the first backtick and the final apostrophe were meant
to be inside matched quotes
- asciidoc got confused by the escaping of some of our
asterisks. In particular,
`credential.\*` and `credential.<url>.\*`
properly escaped the asterisk in the first case, but
literally passed through the backslash in the second
case.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-04-26 08:51:57 +00:00
|
|
|
`+`;; for a successful forced update;
|
2010-02-09 00:45:21 +00:00
|
|
|
`-`;; for a successfully deleted ref;
|
|
|
|
`*`;; for a successfully pushed new ref;
|
|
|
|
`!`;; for a ref that was rejected or failed to push; and
|
|
|
|
`=`;; for a ref that was up to date and did not need pushing.
|
2008-02-19 16:26:45 +00:00
|
|
|
|
|
|
|
summary::
|
|
|
|
For a successfully pushed ref, the summary shows the old and new
|
|
|
|
values of the ref in a form suitable for using as an argument to
|
|
|
|
`git log` (this is `<old>..<new>` in most cases, and
|
docs: stop using asciidoc no-inline-literal
In asciidoc 7, backticks like `foo` produced a typographic
effect, but did not otherwise affect the syntax. In asciidoc
8, backticks introduce an "inline literal" inside which markup
is not interpreted. To keep compatibility with existing
documents, asciidoc 8 has a "no-inline-literal" attribute to
keep the old behavior. We enabled this so that the
documentation could be built on either version.
It has been several years now, and asciidoc 7 is no longer
in wide use. We can now decide whether or not we want
inline literals on their own merits, which are:
1. The source is much easier to read when the literal
contains punctuation. You can use `master~1` instead
of `master{tilde}1`.
2. They are less error-prone. Because of point (1), we
tend to make mistakes and forget the extra layer of
quoting.
This patch removes the no-inline-literal attribute from the
Makefile and converts every use of backticks in the
documentation to an inline literal (they must be cleaned up,
or the example above would literally show "{tilde}" in the
output).
Problematic sites were found by grepping for '`.*[{\\]' and
examined and fixed manually. The results were then verified
by comparing the output of "html2text" on the set of
generated html pages. Doing so revealed that in addition to
making the source more readable, this patch fixes several
formatting bugs:
- HTML rendering used the ellipsis character instead of
literal "..." in code examples (like "git log A...B")
- some code examples used the right-arrow character
instead of '->' because they failed to quote
- api-config.txt did not quote tilde, and the resulting
HTML contained a bogus snippet like:
<tt><sub></tt> foo <tt></sub>bar</tt>
which caused some parsers to choke and omit whole
sections of the page.
- git-commit.txt confused ``foo`` (backticks inside a
literal) with ``foo'' (matched double-quotes)
- mentions of `A U Thor <author@example.com>` used to
erroneously auto-generate a mailto footnote for
author@example.com
- the description of --word-diff=plain incorrectly showed
the output as "[-removed-] and {added}", not "{+added+}".
- using "prime" notation like:
commit `C` and its replacement `C'`
confused asciidoc into thinking that everything between
the first backtick and the final apostrophe were meant
to be inside matched quotes
- asciidoc got confused by the escaping of some of our
asterisks. In particular,
`credential.\*` and `credential.<url>.\*`
properly escaped the asterisk in the first case, but
literally passed through the backslash in the second
case.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-04-26 08:51:57 +00:00
|
|
|
`<old>...<new>` for forced non-fast-forward updates).
|
2010-07-24 16:03:15 +00:00
|
|
|
+
|
|
|
|
For a failed update, more details are given:
|
|
|
|
+
|
|
|
|
--
|
|
|
|
rejected::
|
|
|
|
Git did not try to send the ref at all, typically because it
|
|
|
|
is not a fast-forward and you did not force the update.
|
|
|
|
|
|
|
|
remote rejected::
|
|
|
|
The remote end refused the update. Usually caused by a hook
|
|
|
|
on the remote side, or because the remote repository has one
|
|
|
|
of the following safety options in effect:
|
|
|
|
`receive.denyCurrentBranch` (for pushes to the checked out
|
|
|
|
branch), `receive.denyNonFastForwards` (for forced
|
|
|
|
non-fast-forward updates), `receive.denyDeletes` or
|
|
|
|
`receive.denyDeleteCurrent`. See linkgit:git-config[1].
|
|
|
|
|
|
|
|
remote failure::
|
|
|
|
The remote end did not report the successful update of the ref,
|
|
|
|
perhaps because of a temporary error on the remote side, a
|
|
|
|
break in the network connection, or other transient error.
|
|
|
|
--
|
2008-02-19 16:26:45 +00:00
|
|
|
|
|
|
|
from::
|
|
|
|
The name of the local ref being pushed, minus its
|
|
|
|
`refs/<type>/` prefix. In the case of deletion, the
|
|
|
|
name of the local ref is omitted.
|
|
|
|
|
|
|
|
to::
|
|
|
|
The name of the remote ref being updated, minus its
|
|
|
|
`refs/<type>/` prefix.
|
|
|
|
|
|
|
|
reason::
|
|
|
|
A human-readable explanation. In the case of successfully pushed
|
|
|
|
refs, no explanation is needed. For a failed ref, the reason for
|
|
|
|
failure is described.
|
2007-06-09 18:01:23 +00:00
|
|
|
|
2018-04-30 15:35:33 +00:00
|
|
|
NOTE ABOUT FAST-FORWARDS
|
2009-08-08 07:51:08 +00:00
|
|
|
------------------------
|
|
|
|
|
|
|
|
When an update changes a branch (or more in general, a ref) that used to
|
|
|
|
point at commit A to point at another commit B, it is called a
|
|
|
|
fast-forward update if and only if B is a descendant of A.
|
|
|
|
|
|
|
|
In a fast-forward update from A to B, the set of commits that the original
|
|
|
|
commit A built on top of is a subset of the commits the new commit B
|
|
|
|
builds on top of. Hence, it does not lose any history.
|
|
|
|
|
|
|
|
In contrast, a non-fast-forward update will lose history. For example,
|
|
|
|
suppose you and somebody else started at the same commit X, and you built
|
|
|
|
a history leading to commit B while the other person built a history
|
|
|
|
leading to commit A. The history looks like this:
|
|
|
|
|
|
|
|
----------------
|
|
|
|
|
|
|
|
B
|
|
|
|
/
|
|
|
|
---X---A
|
|
|
|
|
|
|
|
----------------
|
|
|
|
|
|
|
|
Further suppose that the other person already pushed changes leading to A
|
2012-11-27 01:37:34 +00:00
|
|
|
back to the original repository from which you two obtained the original
|
|
|
|
commit X.
|
2009-08-08 07:51:08 +00:00
|
|
|
|
|
|
|
The push done by the other person updated the branch that used to point at
|
|
|
|
commit X to point at commit A. It is a fast-forward.
|
|
|
|
|
|
|
|
But if you try to push, you will attempt to update the branch (that
|
|
|
|
now points at A) with commit B. This does _not_ fast-forward. If you did
|
|
|
|
so, the changes introduced by commit A will be lost, because everybody
|
|
|
|
will now start building on top of B.
|
|
|
|
|
|
|
|
The command by default does not allow an update that is not a fast-forward
|
|
|
|
to prevent such loss of history.
|
|
|
|
|
2014-03-31 22:11:44 +00:00
|
|
|
If you do not want to lose your work (history from X to B) or the work by
|
2009-08-08 07:51:08 +00:00
|
|
|
the other person (history from X to A), you would need to first fetch the
|
|
|
|
history from the repository, create a history that contains changes done
|
|
|
|
by both parties, and push the result back.
|
|
|
|
|
|
|
|
You can perform "git pull", resolve potential conflicts, and "git push"
|
|
|
|
the result. A "git pull" will create a merge commit C between commits A
|
|
|
|
and B.
|
|
|
|
|
|
|
|
----------------
|
|
|
|
|
|
|
|
B---C
|
|
|
|
/ /
|
|
|
|
---X---A
|
|
|
|
|
|
|
|
----------------
|
|
|
|
|
|
|
|
Updating A with the resulting merge commit will fast-forward and your
|
|
|
|
push will be accepted.
|
|
|
|
|
|
|
|
Alternatively, you can rebase your change between X and B on top of A,
|
|
|
|
with "git pull --rebase", and push the result back. The rebase will
|
|
|
|
create a new commit D that builds the change between X and B on top of
|
|
|
|
A.
|
|
|
|
|
|
|
|
----------------
|
|
|
|
|
|
|
|
B D
|
|
|
|
/ /
|
|
|
|
---X---A
|
|
|
|
|
|
|
|
----------------
|
|
|
|
|
|
|
|
Again, updating A with this commit will fast-forward and your push will be
|
|
|
|
accepted.
|
|
|
|
|
|
|
|
There is another common situation where you may encounter non-fast-forward
|
|
|
|
rejection when you try to push, and it is possible even when you are
|
|
|
|
pushing into a repository nobody else pushes into. After you push commit
|
|
|
|
A yourself (in the first picture in this section), replace it with "git
|
|
|
|
commit --amend" to produce commit B, and you try to push it out, because
|
|
|
|
forgot that you have pushed A out already. In such a case, and only if
|
|
|
|
you are certain that nobody in the meantime fetched your earlier commit A
|
|
|
|
(and started building on top of it), you can run "git push --force" to
|
|
|
|
overwrite it. In other words, "git push --force" is a method reserved for
|
|
|
|
a case where you do mean to lose history.
|
|
|
|
|
|
|
|
|
2018-04-30 15:35:33 +00:00
|
|
|
EXAMPLES
|
2007-06-09 18:01:23 +00:00
|
|
|
--------
|
|
|
|
|
docs: put listed example commands in backticks
Many examples of git command invocation are given in asciidoc listing
blocks, which makes them monospaced and avoids further interpretation of
special characters. Some manpages make a list of examples, like:
git foo::
Run git foo.
git foo -q::
Use the "-q" option.
to quickly show many variants. However, they can sometimes be hard to
read, because they are shown in a proportional-width font (so, for
example, seeing the difference between "-- foo" and "--foo" can be
difficult).
This patch puts all such examples into backticks, which gives the
equivalent formatting to a listing block (i.e., monospaced and without
character interpretation).
As a bonus, this also fixes an example in the git-push manpage, in which
"git push origin :::" was accidentally considered a newly-indented list,
and not a list item with "git push origin :" in it.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-08-04 02:13:29 +00:00
|
|
|
`git push`::
|
2009-03-15 02:32:01 +00:00
|
|
|
Works like `git push <remote>`, where <remote> is the
|
|
|
|
current branch's remote (or `origin`, if no remote is
|
|
|
|
configured for the current branch).
|
|
|
|
|
docs: put listed example commands in backticks
Many examples of git command invocation are given in asciidoc listing
blocks, which makes them monospaced and avoids further interpretation of
special characters. Some manpages make a list of examples, like:
git foo::
Run git foo.
git foo -q::
Use the "-q" option.
to quickly show many variants. However, they can sometimes be hard to
read, because they are shown in a proportional-width font (so, for
example, seeing the difference between "-- foo" and "--foo" can be
difficult).
This patch puts all such examples into backticks, which gives the
equivalent formatting to a listing block (i.e., monospaced and without
character interpretation).
As a bonus, this also fixes an example in the git-push manpage, in which
"git push origin :::" was accidentally considered a newly-indented list,
and not a list item with "git push origin :" in it.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-08-04 02:13:29 +00:00
|
|
|
`git push origin`::
|
2013-01-05 00:02:29 +00:00
|
|
|
Without additional configuration, pushes the current branch to
|
2021-03-08 18:43:47 +00:00
|
|
|
the configured upstream (`branch.<name>.merge` configuration
|
2013-01-05 00:02:29 +00:00
|
|
|
variable) if it has the same name as the current branch, and
|
|
|
|
errors out without pushing otherwise.
|
2009-03-15 02:32:01 +00:00
|
|
|
+
|
|
|
|
The default behavior of this command when no <refspec> is given can be
|
2012-10-02 15:38:00 +00:00
|
|
|
configured by setting the `push` option of the remote, or the `push.default`
|
|
|
|
configuration variable.
|
2009-03-15 02:32:01 +00:00
|
|
|
+
|
|
|
|
For example, to default to pushing only the current branch to `origin`
|
|
|
|
use `git config remote.origin.push HEAD`. Any valid <refspec> (like
|
|
|
|
the ones in the examples below) can be configured as the default for
|
|
|
|
`git push origin`.
|
|
|
|
|
docs: put listed example commands in backticks
Many examples of git command invocation are given in asciidoc listing
blocks, which makes them monospaced and avoids further interpretation of
special characters. Some manpages make a list of examples, like:
git foo::
Run git foo.
git foo -q::
Use the "-q" option.
to quickly show many variants. However, they can sometimes be hard to
read, because they are shown in a proportional-width font (so, for
example, seeing the difference between "-- foo" and "--foo" can be
difficult).
This patch puts all such examples into backticks, which gives the
equivalent formatting to a listing block (i.e., monospaced and without
character interpretation).
As a bonus, this also fixes an example in the git-push manpage, in which
"git push origin :::" was accidentally considered a newly-indented list,
and not a list item with "git push origin :" in it.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-08-04 02:13:29 +00:00
|
|
|
`git push origin :`::
|
2009-03-15 02:32:01 +00:00
|
|
|
Push "matching" branches to `origin`. See
|
|
|
|
<refspec> in the <<OPTIONS,OPTIONS>> section above for a
|
|
|
|
description of "matching" branches.
|
|
|
|
|
docs: put listed example commands in backticks
Many examples of git command invocation are given in asciidoc listing
blocks, which makes them monospaced and avoids further interpretation of
special characters. Some manpages make a list of examples, like:
git foo::
Run git foo.
git foo -q::
Use the "-q" option.
to quickly show many variants. However, they can sometimes be hard to
read, because they are shown in a proportional-width font (so, for
example, seeing the difference between "-- foo" and "--foo" can be
difficult).
This patch puts all such examples into backticks, which gives the
equivalent formatting to a listing block (i.e., monospaced and without
character interpretation).
As a bonus, this also fixes an example in the git-push manpage, in which
"git push origin :::" was accidentally considered a newly-indented list,
and not a list item with "git push origin :" in it.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-08-04 02:13:29 +00:00
|
|
|
`git push origin master`::
|
2007-06-09 18:01:23 +00:00
|
|
|
Find a ref that matches `master` in the source repository
|
|
|
|
(most likely, it would find `refs/heads/master`), and update
|
|
|
|
the same ref (e.g. `refs/heads/master`) in `origin` repository
|
2008-04-21 03:31:24 +00:00
|
|
|
with it. If `master` did not exist remotely, it would be
|
|
|
|
created.
|
2007-06-09 18:01:23 +00:00
|
|
|
|
docs: put listed example commands in backticks
Many examples of git command invocation are given in asciidoc listing
blocks, which makes them monospaced and avoids further interpretation of
special characters. Some manpages make a list of examples, like:
git foo::
Run git foo.
git foo -q::
Use the "-q" option.
to quickly show many variants. However, they can sometimes be hard to
read, because they are shown in a proportional-width font (so, for
example, seeing the difference between "-- foo" and "--foo" can be
difficult).
This patch puts all such examples into backticks, which gives the
equivalent formatting to a listing block (i.e., monospaced and without
character interpretation).
As a bonus, this also fixes an example in the git-push manpage, in which
"git push origin :::" was accidentally considered a newly-indented list,
and not a list item with "git push origin :" in it.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-08-04 02:13:29 +00:00
|
|
|
`git push origin HEAD`::
|
2009-01-25 23:45:32 +00:00
|
|
|
A handy way to push the current branch to the same name on the
|
|
|
|
remote.
|
2007-06-09 18:01:23 +00:00
|
|
|
|
2012-11-27 23:52:27 +00:00
|
|
|
`git push mothership master:satellite/master dev:satellite/dev`::
|
2008-07-29 23:13:38 +00:00
|
|
|
Use the source ref that matches `master` (e.g. `refs/heads/master`)
|
|
|
|
to update the ref that matches `satellite/master` (most probably
|
2012-11-27 23:52:27 +00:00
|
|
|
`refs/remotes/satellite/master`) in the `mothership` repository;
|
2008-07-29 23:13:38 +00:00
|
|
|
do the same for `dev` and `satellite/dev`.
|
2012-11-27 23:52:27 +00:00
|
|
|
+
|
2018-11-13 19:52:45 +00:00
|
|
|
See the section describing `<refspec>...` above for a discussion of
|
|
|
|
the matching semantics.
|
|
|
|
+
|
2012-11-27 23:52:27 +00:00
|
|
|
This is to emulate `git fetch` run on the `mothership` using `git
|
|
|
|
push` that is run in the opposite direction in order to integrate
|
|
|
|
the work done on `satellite`, and is often necessary when you can
|
|
|
|
only make connection in one way (i.e. satellite can ssh into
|
|
|
|
mothership but mothership cannot initiate connection to satellite
|
|
|
|
because the latter is behind a firewall or does not run sshd).
|
|
|
|
+
|
|
|
|
After running this `git push` on the `satellite` machine, you would
|
|
|
|
ssh into the `mothership` and run `git merge` there to complete the
|
|
|
|
emulation of `git pull` that were run on `mothership` to pull changes
|
|
|
|
made on `satellite`.
|
2007-06-09 18:01:23 +00:00
|
|
|
|
docs: put listed example commands in backticks
Many examples of git command invocation are given in asciidoc listing
blocks, which makes them monospaced and avoids further interpretation of
special characters. Some manpages make a list of examples, like:
git foo::
Run git foo.
git foo -q::
Use the "-q" option.
to quickly show many variants. However, they can sometimes be hard to
read, because they are shown in a proportional-width font (so, for
example, seeing the difference between "-- foo" and "--foo" can be
difficult).
This patch puts all such examples into backticks, which gives the
equivalent formatting to a listing block (i.e., monospaced and without
character interpretation).
As a bonus, this also fixes an example in the git-push manpage, in which
"git push origin :::" was accidentally considered a newly-indented list,
and not a list item with "git push origin :" in it.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-08-04 02:13:29 +00:00
|
|
|
`git push origin HEAD:master`::
|
2009-01-25 23:45:32 +00:00
|
|
|
Push the current branch to the remote ref matching `master` in the
|
|
|
|
`origin` repository. This form is convenient to push the current
|
|
|
|
branch without thinking about its local name.
|
|
|
|
|
docs: put listed example commands in backticks
Many examples of git command invocation are given in asciidoc listing
blocks, which makes them monospaced and avoids further interpretation of
special characters. Some manpages make a list of examples, like:
git foo::
Run git foo.
git foo -q::
Use the "-q" option.
to quickly show many variants. However, they can sometimes be hard to
read, because they are shown in a proportional-width font (so, for
example, seeing the difference between "-- foo" and "--foo" can be
difficult).
This patch puts all such examples into backticks, which gives the
equivalent formatting to a listing block (i.e., monospaced and without
character interpretation).
As a bonus, this also fixes an example in the git-push manpage, in which
"git push origin :::" was accidentally considered a newly-indented list,
and not a list item with "git push origin :" in it.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-08-04 02:13:29 +00:00
|
|
|
`git push origin master:refs/heads/experimental`::
|
2007-09-06 04:44:08 +00:00
|
|
|
Create the branch `experimental` in the `origin` repository
|
2008-04-21 03:31:24 +00:00
|
|
|
by copying the current `master` branch. This form is only
|
|
|
|
needed to create a new branch or tag in the remote repository when
|
|
|
|
the local name and the remote name are different; otherwise,
|
|
|
|
the ref name on its own will work.
|
2007-09-06 04:44:08 +00:00
|
|
|
|
docs: put listed example commands in backticks
Many examples of git command invocation are given in asciidoc listing
blocks, which makes them monospaced and avoids further interpretation of
special characters. Some manpages make a list of examples, like:
git foo::
Run git foo.
git foo -q::
Use the "-q" option.
to quickly show many variants. However, they can sometimes be hard to
read, because they are shown in a proportional-width font (so, for
example, seeing the difference between "-- foo" and "--foo" can be
difficult).
This patch puts all such examples into backticks, which gives the
equivalent formatting to a listing block (i.e., monospaced and without
character interpretation).
As a bonus, this also fixes an example in the git-push manpage, in which
"git push origin :::" was accidentally considered a newly-indented list,
and not a list item with "git push origin :" in it.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-08-04 02:13:29 +00:00
|
|
|
`git push origin :experimental`::
|
2009-01-25 23:45:32 +00:00
|
|
|
Find a ref that matches `experimental` in the `origin` repository
|
|
|
|
(e.g. `refs/heads/experimental`), and delete it.
|
|
|
|
|
docs: stop using asciidoc no-inline-literal
In asciidoc 7, backticks like `foo` produced a typographic
effect, but did not otherwise affect the syntax. In asciidoc
8, backticks introduce an "inline literal" inside which markup
is not interpreted. To keep compatibility with existing
documents, asciidoc 8 has a "no-inline-literal" attribute to
keep the old behavior. We enabled this so that the
documentation could be built on either version.
It has been several years now, and asciidoc 7 is no longer
in wide use. We can now decide whether or not we want
inline literals on their own merits, which are:
1. The source is much easier to read when the literal
contains punctuation. You can use `master~1` instead
of `master{tilde}1`.
2. They are less error-prone. Because of point (1), we
tend to make mistakes and forget the extra layer of
quoting.
This patch removes the no-inline-literal attribute from the
Makefile and converts every use of backticks in the
documentation to an inline literal (they must be cleaned up,
or the example above would literally show "{tilde}" in the
output).
Problematic sites were found by grepping for '`.*[{\\]' and
examined and fixed manually. The results were then verified
by comparing the output of "html2text" on the set of
generated html pages. Doing so revealed that in addition to
making the source more readable, this patch fixes several
formatting bugs:
- HTML rendering used the ellipsis character instead of
literal "..." in code examples (like "git log A...B")
- some code examples used the right-arrow character
instead of '->' because they failed to quote
- api-config.txt did not quote tilde, and the resulting
HTML contained a bogus snippet like:
<tt><sub></tt> foo <tt></sub>bar</tt>
which caused some parsers to choke and omit whole
sections of the page.
- git-commit.txt confused ``foo`` (backticks inside a
literal) with ``foo'' (matched double-quotes)
- mentions of `A U Thor <author@example.com>` used to
erroneously auto-generate a mailto footnote for
author@example.com
- the description of --word-diff=plain incorrectly showed
the output as "[-removed-] and {added}", not "{+added+}".
- using "prime" notation like:
commit `C` and its replacement `C'`
confused asciidoc into thinking that everything between
the first backtick and the final apostrophe were meant
to be inside matched quotes
- asciidoc got confused by the escaping of some of our
asterisks. In particular,
`credential.\*` and `credential.<url>.\*`
properly escaped the asterisk in the first case, but
literally passed through the backslash in the second
case.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-04-26 08:51:57 +00:00
|
|
|
`git push origin +dev:master`::
|
2009-02-19 17:39:47 +00:00
|
|
|
Update the origin repository's master branch with the dev branch,
|
2009-10-24 08:31:32 +00:00
|
|
|
allowing non-fast-forward updates. *This can leave unreferenced
|
2009-02-19 17:39:47 +00:00
|
|
|
commits dangling in the origin repository.* Consider the
|
2009-10-24 08:31:32 +00:00
|
|
|
following situation, where a fast-forward is not possible:
|
2009-02-19 17:39:47 +00:00
|
|
|
+
|
|
|
|
----
|
|
|
|
o---o---o---A---B origin/master
|
|
|
|
\
|
|
|
|
X---Y---Z dev
|
|
|
|
----
|
|
|
|
+
|
|
|
|
The above command would change the origin repository to
|
|
|
|
+
|
|
|
|
----
|
|
|
|
A---B (unnamed branch)
|
|
|
|
/
|
|
|
|
o---o---o---X---Y---Z master
|
|
|
|
----
|
|
|
|
+
|
|
|
|
Commits A and B would no longer belong to a branch with a symbolic name,
|
|
|
|
and so would be unreachable. As such, these commits would be removed by
|
|
|
|
a `git gc` command on the origin repository.
|
|
|
|
|
2016-11-14 18:20:24 +00:00
|
|
|
include::transfer-data-leaks.txt[]
|
|
|
|
|
2022-09-07 08:27:04 +00:00
|
|
|
CONFIGURATION
|
|
|
|
-------------
|
|
|
|
|
|
|
|
include::includes/cmd-config-section-all.txt[]
|
|
|
|
|
|
|
|
include::config/push.txt[]
|
|
|
|
|
2005-08-23 08:49:47 +00:00
|
|
|
GIT
|
|
|
|
---
|
2008-06-06 07:07:32 +00:00
|
|
|
Part of the linkgit:git[1] suite
|