Skip to content

Commit 9f67fee

Browse files
nelhagegitster
authored andcommitted
git-push: Accept -n as a synonym for --dry-run.
git-push is not currently using -n for anything else, and it seems unlikely we will want to use it to mean anything else in the future, so add it as an alias for convenience. Signed-off-by: Nelson Elhage <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 12efe45 commit 9f67fee

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

Documentation/git-push.txt

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

@@ -82,6 +82,7 @@ nor in any Push line of the corresponding remotes file---see below).
8282
if the configuration option `remote.<remote>.mirror` is
8383
set.
8484

85+
-n::
8586
--dry-run::
8687
Do everything except actually send the updates.
8788

builtin-push.c

Lines changed: 2 additions & 2 deletions
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] [--porcelain] [--tags] [--receive-pack=<git-receive-pack>] [--repo=<repository>] [-f | --force] [-v] [<repository> <refspec>...]",
13+
"git push [--all | --mirror] [-n | --dry-run] [--porcelain] [--tags] [--receive-pack=<git-receive-pack>] [--repo=<repository>] [-f | --force] [-v] [<repository> <refspec>...]",
1414
NULL,
1515
};
1616

@@ -182,7 +182,7 @@ int cmd_push(int argc, const char **argv, const char *prefix)
182182
OPT_BIT( 0 , "mirror", &flags, "mirror all refs",
183183
(TRANSPORT_PUSH_MIRROR|TRANSPORT_PUSH_FORCE)),
184184
OPT_BOOLEAN( 0 , "tags", &tags, "push tags"),
185-
OPT_BIT( 0 , "dry-run", &flags, "dry run", TRANSPORT_PUSH_DRY_RUN),
185+
OPT_BIT('n' , "dry-run", &flags, "dry run", TRANSPORT_PUSH_DRY_RUN),
186186
OPT_BIT( 0, "porcelain", &flags, "machine-readable output", TRANSPORT_PUSH_PORCELAIN),
187187
OPT_BIT('f', "force", &flags, "force updates", TRANSPORT_PUSH_FORCE),
188188
OPT_BOOLEAN( 0 , "thin", &thin, "use thin pack"),

0 commit comments

Comments
 (0)