diff options
Diffstat (limited to 'builtin')
-rw-r--r-- | builtin/checkout.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/builtin/checkout.c b/builtin/checkout.c index f884d27f1f..2bca5fe492 100644 --- a/builtin/checkout.c +++ b/builtin/checkout.c @@ -1698,6 +1698,15 @@ int cmd_checkout(int argc, const char **argv, const char *prefix) opts.checkout_index = -2; /* default on */ opts.checkout_worktree = -2; /* default on */ + if (argc == 3 && !strcmp(argv[1], "-b")) { + /* + * User ran 'git checkout -b <branch>' and expects + * the same behavior as 'git switch -c <branch>'. + */ + opts.switch_branch_doing_nothing_is_ok = 0; + opts.only_merge_on_switching_branches = 1; + } + options = parse_options_dup(checkout_options); options = add_common_options(&opts, options); options = add_common_switch_branch_options(&opts, options); |