threads / discuss / 5087

git-push and -f option

Subject: git-push and -f option

## tl;dr

2 messages between Aug 2, 2006 and Aug 2, 2006.

replies: 1people: 2as markdown or json

Jeff King· Aug 2, 2006, 15:28 UTC · re: Aneesh Kumar · lore

[PATCH] git-push: allow -f as an alias for --force

This was already documented in the options section of the manpage. This patch implements it, adds it to the usage message, and mentions it at the top of the manpage.

Signed-off-by: Jeff King <peff@peff.net>
---
On Wed, Aug 02, 2006 at 02:03:12PM +0530, Aneesh Kumar wrote:
> The man page says -f is same as --force.  But the script doesn't seems
> to handle this.
 Documentation/git-push.txt |    2 +-
 builtin-push.c             |    4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/Documentation/git-push.txt b/Documentation/git-push.txt
index 56afd64..d4ae99f 100644
--- a/Documentation/git-push.txt
+++ b/Documentation/git-push.txt
@@ -8,7 +8,7 @@ git-push - Update remote refs along with
 
 SYNOPSIS
 --------
-'git-push' [--all] [--tags] [--force] <repository> <refspec>...
+'git-push' [--all] [--tags] [-f | --force] <repository> <refspec>...
 
 DESCRIPTION
 -----------
diff --git a/builtin-push.c b/builtin-push.c
index a824171..c39dd1e 100644
--- a/builtin-push.c
+++ b/builtin-push.c
@@ -8,7 +8,7 @@ #include "builtin.h"
 
 #define MAX_URI (16)
 
-static const char push_usage[] = "git push [--all] [--tags] [--force] <repository> [<refspec>...]";
+static const char push_usage[] = "git push [--all] [--tags] [-f | --force] <repository> [<refspec>...]";
 
 static int all = 0, tags = 0, force = 0, thin = 1;
 static const char *execute = NULL;
@@ -291,7 +291,7 @@ int cmd_push(int argc, const char **argv
 			tags = 1;
 			continue;
 		}
-		if (!strcmp(arg, "--force")) {
+		if (!strcmp(arg, "--force") || !strcmp(arg, "-f")) {
 			force = 1;
 			continue;
 		}
-- 
1.4.2.rc2.g822a-dirty

← back to recent threads