diff options
| author | Yoichi NAKAYAMA <yoichi.nakayama@gmail.com> | 2026-08-27 14:41:57 +0000 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2026-08-27 10:29:43 -0700 |
| commit | b70101c22431bb77ef1d174cb7309f2eaab68c0e (patch) | |
| tree | 2fb92d04e38612573e8a86b6bfa8bdcdbd36a60c /contrib/persistent-https | |
| parent | 85489606d89d44d7aed6e46839ec8ff46f52562d (diff) | |
worktree add: treat multiple matches with --guess-remote as an error
When 'git worktree add <path>' is invoked without <commit-ish> and
with the --guess-remote option (or when worktree.guessRemote is set to
true), it tries to find a remote-tracking branch matching the basename
of <path>.
Currently, the behavior when multiple matches are found is the same as
when no match is found: it falls back to creating a branch from
HEAD. This has been the behavior since 71d6682d8c (worktree: add
--guess-remote option to add subcommand, 2017-11-29), when the option
was first introduced.
However, if the specified <path> matches any remote-tracking branch,
we infer that the user intended to use one of the remote-tracking
branches as the start-point rather than HEAD. So we abort the creation
of the branch and worktree when there are multiple matches, and
instruct the user to choose the start-point.
Signed-off-by: Yoichi NAKAYAMA <yoichi.nakayama@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'contrib/persistent-https')
0 files changed, 0 insertions, 0 deletions
