Skip to content

Commit bf07cc5

Browse files
Johannes Sixtspearce
authored andcommitted
git-push.txt: Describe --repo option in more detail
The --repo option was described in a way that the reader would have to assume that it is the same as the <repository> parameter. But it actually servers a purpose, which is now written down. Furthermore, the --mirror option was missing from the synopsis. Signed-off-by: Johannes Sixt <[email protected]> Signed-off-by: Shawn O. Pearce <[email protected]>
1 parent cced48a commit bf07cc5

File tree

2 files changed

+20
-6
lines changed

2 files changed

+20
-6
lines changed

Documentation/git-push.txt

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ git-push - Update remote refs along with associated objects
99
SYNOPSIS
1010
--------
1111
[verse]
12-
'git push' [--all] [--dry-run] [--tags] [--receive-pack=<git-receive-pack>]
13-
[--repo=all] [-f | --force] [-v | --verbose]
12+
'git push' [--all | --mirror] [--dry-run] [--tags] [--receive-pack=<git-receive-pack>]
13+
[--repo=<repository>] [-f | --force] [-v | --verbose]
1414
[<repository> <refspec>...]
1515

1616
DESCRIPTION
@@ -101,9 +101,23 @@ nor in any Push line of the corresponding remotes file---see below).
101101
This flag disables the check. This can cause the
102102
remote repository to lose commits; use it with care.
103103

104-
--repo=<repo>::
105-
When no repository is specified the command defaults to
106-
"origin"; this overrides it.
104+
--repo=<repository>::
105+
This option is only relevant if no <repository> argument is
106+
passed in the invocation. In this case, 'git-push' derives the
107+
remote name from the current branch: If it tracks a remote
108+
branch, then that remote repository is pushed to. Otherwise,
109+
the name "origin" is used. For this latter case, this option
110+
can be used to override the name "origin". In other words,
111+
the difference between these two commands
112+
+
113+
--------------------------
114+
git push public #1
115+
git push --repo=public #2
116+
--------------------------
117+
+
118+
is that #1 always pushes to "public" whereas #2 pushes to "public"
119+
only if the current branch does not track a remote branch. This is
120+
useful if you write an alias or script around 'git-push'.
107121

108122
--thin::
109123
--no-thin::

builtin-push.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#include "parse-options.h"
1111

1212
static const char * const push_usage[] = {
13-
"git push [--all | --mirror] [--dry-run] [--tags] [--receive-pack=<git-receive-pack>] [--repo=all] [-f | --force] [-v] [<repository> <refspec>...]",
13+
"git push [--all | --mirror] [--dry-run] [--tags] [--receive-pack=<git-receive-pack>] [--repo=<repository>] [-f | --force] [-v] [<repository> <refspec>...]",
1414
NULL,
1515
};
1616

0 commit comments

Comments
 (0)