@@ -19,30 +19,35 @@ SYNOPSIS
1919DESCRIPTION
2020-----------
2121
22- Updates remote refs using local refs, while sending objects
23- necessary to complete the given refs.
22+ Updates one or more branches, tags, or other references in a remote
23+ repository from your local repository, and sends all necessary data
24+ that isn't already on the remote.
2425
25- You can make interesting things happen to a repository
26- every time you push into it, by setting up 'hooks' there. See
27- documentation for linkgit:git-receive-pack[1].
26+ The simplest way to push is `git push <remote> <branch>` .
27+ `git push origin main` will push the local `main` branch to the `main`
28+ branch on the remote named `origin` .
29+
30+ The `<repository>` argument defaults to the upstream for the current branch,
31+ or `origin` if there's no configured upstream.
2832
29- When the command line does not specify where to push with the
30- `<repository>` argument, `branch.*.remote` configuration for the
31- current branch is consulted to determine where to push. If the
32- configuration is missing, it defaults to 'origin' .
33+ To decide which branches, tags, or other refs to push, Git uses
34+ (in order of precedence):
3335
34- When the command line does not specify what to push with `<refspec>...`
35- arguments or `--all` , `--mirror` , `--tags` options, the command finds
36- the default `<refspec>` by consulting `remote.*.push` configuration,
37- and if it is not found, honors `push.default` configuration to decide
38- what to push (See linkgit:git-config[1] for the meaning of `push.default` ).
36+ 1. The `<refspec>` argument(s) (for example `main` in `git push origin main` )
37+ or the `--all` , `--mirror` , or `--tags` options
38+ 2. The `remote.*.push` configuration for the repository being pushed to
39+ 3. The `push.default` configuration. The default is `push.default=simple` ,
40+ which will push to a branch with the same name as the current branch.
41+ See the <<CONFIGURATION,CONFIGURATION>> section below for more on `push.default` .
3942
40- When neither the command-line nor the configuration specifies what to
41- push, the default behavior is used, which corresponds to the `simple`
42- value for `push.default` : the current branch is pushed to the
43- corresponding upstream branch, but as a safety measure, the push is
44- aborted if the upstream branch does not have the same name as the
45- local one.
43+ `git push` may fail if you haven't set an upstream for the current branch,
44+ depending on what `push.default` is set to.
45+ See the <<UPSTREAM-BRANCHES,UPSTREAM BRANCHES>> section below for more
46+ on how to set and use upstreams.
47+
48+ You can make interesting things happen to a repository
49+ every time you push into it, by setting up 'hooks' there. See
50+ documentation for linkgit:git-receive-pack[1].
4651
4752
4853OPTIONS[[OPTIONS]]
@@ -710,6 +715,7 @@ a `git gc` command on the origin repository.
710715
711716include::transfer-data-leaks.adoc[]
712717
718+ [[CONFIGURATION]]
713719CONFIGURATION
714720-------------
715721
0 commit comments