Skip to content

Commit f7aec12

Browse files
René Scharfegitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 53a1116 commit f7aec12

File tree

10 files changed

+11
-5
lines changed

10 files changed

+11
-5
lines changed

Documentation/git-branch.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ OPTIONS
7676
based sha1 expressions such as "<branchname>@\{yesterday}".
7777

7878
-f::
79+
--force::
7980
Reset <branchname> to <startpoint> if <branchname> exists
8081
already. Without `-f` 'git-branch' refuses to change an existing branch.
8182

Documentation/git-checkout.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,11 @@ file can be discarded to recreate the original conflicted merge result.
4545
OPTIONS
4646
-------
4747
-q::
48+
--quiet::
4849
Quiet, suppress feedback messages.
4950

5051
-f::
52+
--force::
5153
When switching branches, proceed even if the index or the
5254
working tree differs from HEAD. This is used to throw away
5355
local changes.

Documentation/git-clean.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ OPTIONS
3232
if you really want to remove such a directory.
3333

3434
-f::
35+
--force::
3536
If the git configuration specifies clean.requireForce as true,
3637
'git-clean' will refuse to run unless given -f or -n.
3738

Documentation/git-mv.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ committed.
2828
OPTIONS
2929
-------
3030
-f::
31+
--force::
3132
Force renaming or moving of a file even if the target exists
3233
-k::
3334
Skip move or rename actions which would lead to an error

Documentation/git-tag.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ OPTIONS
5151
Make a GPG-signed tag, using the given key
5252

5353
-f::
54+
--force::
5455
Replace an existing tag with the given name (instead of failing)
5556

5657
-d::

builtin-branch.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -586,7 +586,7 @@ int cmd_branch(int argc, const char **argv, const char *prefix)
586586
OPT_BIT('m', NULL, &rename, "move/rename a branch and its reflog", 1),
587587
OPT_BIT('M', NULL, &rename, "move/rename a branch, even if target exists", 2),
588588
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)"),
590590
{
591591
OPTION_CALLBACK, 0, "no-merged", &merge_filter_ref,
592592
"commit", "print only not merged branches",

builtin-checkout.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -584,7 +584,7 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)
584584
2),
585585
OPT_SET_INT('3', "theirs", &opts.writeout_stage, "stage",
586586
3),
587-
OPT_BOOLEAN('f', NULL, &opts.force, "force"),
587+
OPT_BOOLEAN('f', "force", &opts.force, "force"),
588588
OPT_BOOLEAN('m', "merge", &opts.merge, "merge"),
589589
OPT_STRING(0, "conflict", &conflict_style, "style",
590590
"conflict style (merge or diff3)"),

builtin-clean.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ int cmd_clean(int argc, const char **argv, const char *prefix)
4141
struct option options[] = {
4242
OPT__QUIET(&quiet),
4343
OPT__DRY_RUN(&show_only),
44-
OPT_BOOLEAN('f', NULL, &force, "force"),
44+
OPT_BOOLEAN('f', "force", &force, "force"),
4545
OPT_BOOLEAN('d', NULL, &remove_directories,
4646
"remove whole directories"),
4747
OPT_BOOLEAN('x', NULL, &ignored, "remove ignored files, too"),

builtin-mv.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
5353
int verbose = 0, show_only = 0, force = 0, ignore_errors = 0;
5454
struct option builtin_mv_options[] = {
5555
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"),
5757
OPT_BOOLEAN('k', NULL, &ignore_errors, "skip move/rename errors"),
5858
OPT_END(),
5959
};

builtin-tag.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ int cmd_tag(int argc, const char **argv, const char *prefix)
390390
OPT_BOOLEAN('s', NULL, &sign, "annotated and GPG-signed tag"),
391391
OPT_STRING('u', NULL, &keyid, "key-id",
392392
"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"),
394394

395395
OPT_GROUP("Tag listing options"),
396396
{

0 commit comments

Comments
 (0)