switch: add short option for --detach
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>
Fri, 29 Mar 2019 10:39:12 +0000 (17:39 +0700)
committerJunio C Hamano <gitster@pobox.com>
Tue, 2 Apr 2019 04:57:00 +0000 (13:57 +0900)
"git checkout" automatically detaches branches and --detach is not
that useful (--no-detach is more likely). But for "switch", you
may want to use it more often once you're used to detached HEAD. This
of course adds -d to git-checkout but it does not harm (yet?) to do it.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/checkout.c
index 4416b82bfde3f629e227d098739fa1ff8ee261e5..11308ab80c650a5a9f5d24cc304726e321202680 100644 (file)
@@ -1423,7 +1423,7 @@ static struct option *add_common_switch_branch_options(
        struct checkout_opts *opts, struct option *prevopts)
 {
        struct option options[] = {
-               OPT_BOOL(0, "detach", &opts->force_detach, N_("detach HEAD at named commit")),
+               OPT_BOOL('d', "detach", &opts->force_detach, N_("detach HEAD at named commit")),
                OPT_SET_INT('t', "track",  &opts->track, N_("set upstream info for new branch"),
                        BRANCH_TRACK_EXPLICIT),
                OPT_STRING(0, "orphan", &opts->new_orphan_branch, N_("new-branch"), N_("new unparented branch")),