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>
This commit is contained in:
René Scharfe 2009-08-29 11:05:00 +02:00 committed by Junio C Hamano
parent 53a1116c61
commit f7aec129fa
10 changed files with 11 additions and 5 deletions

View File

@ -76,6 +76,7 @@ OPTIONS
based sha1 expressions such as "<branchname>@\{yesterday}". based sha1 expressions such as "<branchname>@\{yesterday}".
-f:: -f::
--force::
Reset <branchname> to <startpoint> if <branchname> exists Reset <branchname> to <startpoint> if <branchname> exists
already. Without `-f` 'git-branch' refuses to change an existing branch. already. Without `-f` 'git-branch' refuses to change an existing branch.

View File

@ -45,9 +45,11 @@ file can be discarded to recreate the original conflicted merge result.
OPTIONS OPTIONS
------- -------
-q:: -q::
--quiet::
Quiet, suppress feedback messages. Quiet, suppress feedback messages.
-f:: -f::
--force::
When switching branches, proceed even if the index or the When switching branches, proceed even if the index or the
working tree differs from HEAD. This is used to throw away working tree differs from HEAD. This is used to throw away
local changes. local changes.

View File

@ -32,6 +32,7 @@ OPTIONS
if you really want to remove such a directory. if you really want to remove such a directory.
-f:: -f::
--force::
If the git configuration specifies clean.requireForce as true, If the git configuration specifies clean.requireForce as true,
'git-clean' will refuse to run unless given -f or -n. 'git-clean' will refuse to run unless given -f or -n.

View File

@ -28,6 +28,7 @@ committed.
OPTIONS OPTIONS
------- -------
-f:: -f::
--force::
Force renaming or moving of a file even if the target exists Force renaming or moving of a file even if the target exists
-k:: -k::
Skip move or rename actions which would lead to an error Skip move or rename actions which would lead to an error

View File

@ -51,6 +51,7 @@ OPTIONS
Make a GPG-signed tag, using the given key Make a GPG-signed tag, using the given key
-f:: -f::
--force::
Replace an existing tag with the given name (instead of failing) Replace an existing tag with the given name (instead of failing)
-d:: -d::

View File

@ -586,7 +586,7 @@ int cmd_branch(int argc, const char **argv, const char *prefix)
OPT_BIT('m', NULL, &rename, "move/rename a branch and its reflog", 1), OPT_BIT('m', NULL, &rename, "move/rename a branch and its reflog", 1),
OPT_BIT('M', NULL, &rename, "move/rename a branch, even if target exists", 2), OPT_BIT('M', NULL, &rename, "move/rename a branch, even if target exists", 2),
OPT_BOOLEAN('l', NULL, &reflog, "create the branch's reflog"), OPT_BOOLEAN('l', NULL, &reflog, "create the branch's reflog"),
OPT_BOOLEAN('f', NULL, &force_create, "force creation (when already exists)"), OPT_BOOLEAN('f', "force", &force_create, "force creation (when already exists)"),
{ {
OPTION_CALLBACK, 0, "no-merged", &merge_filter_ref, OPTION_CALLBACK, 0, "no-merged", &merge_filter_ref,
"commit", "print only not merged branches", "commit", "print only not merged branches",

View File

@ -584,7 +584,7 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)
2), 2),
OPT_SET_INT('3', "theirs", &opts.writeout_stage, "stage", OPT_SET_INT('3', "theirs", &opts.writeout_stage, "stage",
3), 3),
OPT_BOOLEAN('f', NULL, &opts.force, "force"), OPT_BOOLEAN('f', "force", &opts.force, "force"),
OPT_BOOLEAN('m', "merge", &opts.merge, "merge"), OPT_BOOLEAN('m', "merge", &opts.merge, "merge"),
OPT_STRING(0, "conflict", &conflict_style, "style", OPT_STRING(0, "conflict", &conflict_style, "style",
"conflict style (merge or diff3)"), "conflict style (merge or diff3)"),

View File

@ -41,7 +41,7 @@ int cmd_clean(int argc, const char **argv, const char *prefix)
struct option options[] = { struct option options[] = {
OPT__QUIET(&quiet), OPT__QUIET(&quiet),
OPT__DRY_RUN(&show_only), OPT__DRY_RUN(&show_only),
OPT_BOOLEAN('f', NULL, &force, "force"), OPT_BOOLEAN('f', "force", &force, "force"),
OPT_BOOLEAN('d', NULL, &remove_directories, OPT_BOOLEAN('d', NULL, &remove_directories,
"remove whole directories"), "remove whole directories"),
OPT_BOOLEAN('x', NULL, &ignored, "remove ignored files, too"), OPT_BOOLEAN('x', NULL, &ignored, "remove ignored files, too"),

View File

@ -53,7 +53,7 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
int verbose = 0, show_only = 0, force = 0, ignore_errors = 0; int verbose = 0, show_only = 0, force = 0, ignore_errors = 0;
struct option builtin_mv_options[] = { struct option builtin_mv_options[] = {
OPT__DRY_RUN(&show_only), OPT__DRY_RUN(&show_only),
OPT_BOOLEAN('f', NULL, &force, "force move/rename even if target exists"), OPT_BOOLEAN('f', "force", &force, "force move/rename even if target exists"),
OPT_BOOLEAN('k', NULL, &ignore_errors, "skip move/rename errors"), OPT_BOOLEAN('k', NULL, &ignore_errors, "skip move/rename errors"),
OPT_END(), OPT_END(),
}; };

View File

@ -390,7 +390,7 @@ int cmd_tag(int argc, const char **argv, const char *prefix)
OPT_BOOLEAN('s', NULL, &sign, "annotated and GPG-signed tag"), OPT_BOOLEAN('s', NULL, &sign, "annotated and GPG-signed tag"),
OPT_STRING('u', NULL, &keyid, "key-id", OPT_STRING('u', NULL, &keyid, "key-id",
"use another key to sign the tag"), "use another key to sign the tag"),
OPT_BOOLEAN('f', NULL, &force, "replace the tag if exists"), OPT_BOOLEAN('f', "force", &force, "replace the tag if exists"),
OPT_GROUP("Tag listing options"), OPT_GROUP("Tag listing options"),
{ {