git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Jeff King <peff@peff.net>
Date
Aug 2, 2006, 15:28 UTC
Message-ID
<20060802152816.GA3923@coredump.intra.peff.net>
In-Reply-To
<cc723f590608020133o3c960cf0v1546c59319253dc0@mail.gmail.com>

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
Previous: Aneesh Kumar
Message 2 of 2 in “git-push and -f option”
  1. Aneesh KumarAug 2, 2006
  2. git-push: allow -f as an alias for --forceJeff King, Aug 2, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.