@@ -19,31 +19,34 @@ SYNOPSIS
19
19
DESCRIPTION
20
20
-----------
21
21
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.
25
+
26
+ To decide which repository to push to, Git uses the `<repository>`
27
+ argument (for example `git push dev` ), then if that's not specified the
28
+ upstream configuration for the current branch, and then defaults
29
+ to `origin` .
30
+
31
+ To decide which branches, tags, or other refs to push, Git uses
32
+ (in order of precedence):
33
+
34
+ 1. The `<refspec>` argument(s) (for example `main` in `git push origin main` )
35
+ or the `--all` , `--mirror` , or `--tags` options
36
+ 2. The `remote.*.push` configuration for the repository being pushed to
37
+ 3. The `push.default` configuration. The default is `push.default=simple` ,
38
+ which will push to a branch with the same name as the current branch.
39
+ See the CONFIGURATION section below for more on `push.default` .
40
+
41
+ As a safety measure, `git push` may fail if you haven't set an upstream
42
+ for the current branch, depending on what `push.default` is set to.
43
+ See the UPSTREAM BRANCHES section below for more on how to set and
44
+ use upstreams.
24
45
25
46
You can make interesting things happen to a repository
26
47
every time you push into it, by setting up 'hooks' there. See
27
48
documentation for linkgit:git-receive-pack[1].
28
49
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
-
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` ).
39
-
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.
46
-
47
50
48
51
OPTIONS[[OPTIONS]]
49
52
------------------
0 commit comments