UI consistency: allow --force for where -f means force
git branch, checkout, clean, mv and tag all have an option -f to override certain checks. This patch makes them accept the long option --force as a synonym. While we're at it, document that checkout support --quiet as synonym for its short option -q. Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx> Signed-off-by: Junio C Hamano <gitster@pobox.com>
René Scharfe committed
Aug 29, 2009 at 11:05 UTC
f7aec129fa78e39e200352502377f57952516f98
10 files changed
+11
-5
Documentation/git-branch.txt
+1
@@ -76,6 +76,7 @@ OPTIONS
76
based sha1 expressions such as "<branchname>@\{yesterday}".
77
78
-f::
79
+--force::
80
Reset <branchname> to <startpoint> if <branchname> exists
81
already. Without `-f` 'git-branch' refuses to change an existing branch.
82
Documentation/git-checkout.txt
+2
@@ -45,9 +45,11 @@ file can be discarded to recreate the original conflicted merge result.
45
OPTIONS
46
-------
47
-q::
48
+--quiet::
49
Quiet, suppress feedback messages.
50
51
-f::
52
+--force::
53
When switching branches, proceed even if the index or the
54
working tree differs from HEAD. This is used to throw away
55
local changes.
Documentation/git-clean.txt
+1
@@ -32,6 +32,7 @@ OPTIONS
32
if you really want to remove such a directory.
33
34
-f::
35
+--force::
36
If the git configuration specifies clean.requireForce as true,
37
'git-clean' will refuse to run unless given -f or -n.
38
Documentation/git-mv.txt
+1
@@ -28,6 +28,7 @@ committed.
28
OPTIONS
29
-------
30
-f::
31
+--force::
32
Force renaming or moving of a file even if the target exists
33
-k::
34
Skip move or rename actions which would lead to an error
Documentation/git-tag.txt
+1
@@ -51,6 +51,7 @@ OPTIONS
51
Make a GPG-signed tag, using the given key
52
53
-f::
54
+--force::
55
Replace an existing tag with the given name (instead of failing)
56
57
-d::
builtin-branch.c
+1
-1
@@ -586,7 +586,7 @@ int cmd_branch(int argc, const char **argv, const char *prefix)
586
OPT_BIT('m', NULL, &rename, "move/rename a branch and its reflog", 1),
587
OPT_BIT('M', NULL, &rename, "move/rename a branch, even if target exists", 2),
588
OPT_BOOLEAN('l', NULL, &reflog, "create the branch's reflog"),
589
- OPT_BOOLEAN('f', NULL, &force_create, "force creation (when already exists)"),
589
+ OPT_BOOLEAN('f', "force", &force_create, "force creation (when already exists)"),
590
{
591
OPTION_CALLBACK, 0, "no-merged", &merge_filter_ref,
592
"commit", "print only not merged branches",
builtin-checkout.c
+1
-1
@@ -584,7 +584,7 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)
584
2),
585
OPT_SET_INT('3', "theirs", &opts.writeout_stage, "stage",
586
3),
587
- OPT_BOOLEAN('f', NULL, &opts.force, "force"),
587
+ OPT_BOOLEAN('f', "force", &opts.force, "force"),
588
OPT_BOOLEAN('m', "merge", &opts.merge, "merge"),
589
OPT_STRING(0, "conflict", &conflict_style, "style",
590
"conflict style (merge or diff3)"),
builtin-clean.c
+1
-1
@@ -41,7 +41,7 @@ int cmd_clean(int argc, const char **argv, const char *prefix)
41
struct option options[] = {
42
OPT__QUIET(&quiet),
43
OPT__DRY_RUN(&show_only),
44
- OPT_BOOLEAN('f', NULL, &force, "force"),
44
+ OPT_BOOLEAN('f', "force", &force, "force"),
45
OPT_BOOLEAN('d', NULL, &remove_directories,
46
"remove whole directories"),
47
OPT_BOOLEAN('x', NULL, &ignored, "remove ignored files, too"),
builtin-mv.c
+1
-1
@@ -53,7 +53,7 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
53
int verbose = 0, show_only = 0, force = 0, ignore_errors = 0;
54
struct option builtin_mv_options[] = {
55
OPT__DRY_RUN(&show_only),
56
- OPT_BOOLEAN('f', NULL, &force, "force move/rename even if target exists"),
56
+ OPT_BOOLEAN('f', "force", &force, "force move/rename even if target exists"),
57
OPT_BOOLEAN('k', NULL, &ignore_errors, "skip move/rename errors"),
58
OPT_END(),
59
};
builtin-tag.c
+1
-1
@@ -390,7 +390,7 @@ int cmd_tag(int argc, const char **argv, const char *prefix)
390
OPT_BOOLEAN('s', NULL, &sign, "annotated and GPG-signed tag"),
391
OPT_STRING('u', NULL, &keyid, "key-id",
392
"use another key to sign the tag"),
393
- OPT_BOOLEAN('f', NULL, &force, "replace the tag if exists"),
393
+ OPT_BOOLEAN('f', "force", &force, "replace the tag if exists"),
394
395
OPT_GROUP("Tag listing options"),
396
{