The force flag is very common in many commands and is commonly abbreviated with '-f', so add that to worktree removal, too by using OPT__FORCE instead of a self cooked OPT_BOOL for force. While at it, add the PARSE_OPT_NOCOMPLETE flag to the force command line option as forcing a removal may lose files. The short form of "-f" is already documented in the man page, so we do not have to adjust the docs. Helped-by: Eric Sunshine <sunshine@xxxxxxxxxxxxxx> Signed-off-by: Stefan Beller <sbeller@xxxxxxxxxx> --- > Should this be using OPT__FORCE, rather than OPT_BOOL, to be > consistent with worktree.c:add()? yes it should. > Also, can you amend the commit message to mention that "git worktree > remove -f" was already documented, and that it was only the > implementation which was lacking? Thanks. done. I tried to clear up the docs, but after reading them a couple times, it looks good as-is. Documentation/git-worktree.txt | 2 +- builtin/worktree.c | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Documentation/git-worktree.txt b/Documentation/git-worktree.txt index e7eb24ab85..99b713c849 100644 --- a/Documentation/git-worktree.txt +++ b/Documentation/git-worktree.txt @@ -14,7 +14,7 @@ SYNOPSIS 'git worktree lock' [--reason <string>] <worktree> 'git worktree move' <worktree> <new-path> 'git worktree prune' [-n] [-v] [--expire <expire>] -'git worktree remove' [--force] <worktree> +'git worktree remove' [-f] <worktree> 'git worktree unlock' <worktree> DESCRIPTION diff --git a/builtin/worktree.c b/builtin/worktree.c index 40a438ed6c..30647b30c5 100644 --- a/builtin/worktree.c +++ b/builtin/worktree.c @@ -783,8 +783,9 @@ static int remove_worktree(int ac, const char **av, const char *prefix) { int force = 0; struct option options[] = { - OPT_BOOL(0, "force", &force, - N_("force removing even if the worktree is dirty")), + OPT__FORCE(&force, + N_("force removing even if the worktree is dirty"), + PARSE_OPT_NOCOMPLETE), OPT_END() }; struct worktree **worktrees, *wt; -- 2.17.0.255.g8bfb7c0704