public inbox for git@vger.kernel.org
 help / color / mirror / Atom feed
* Remote tracking option hint for git-switch still shows git-checkout command
@ 2026-01-27  9:31 Simon Cheng
  2026-01-27 16:29 ` Junio C Hamano
  0 siblings, 1 reply; 2+ messages in thread
From: Simon Cheng @ 2026-01-27  9:31 UTC (permalink / raw)
  To: git

When `git-switch my-branch` is unable to guess a unique remote
tracking branch, the shown hint still displays an example with the
`git-checkout` command.

❯ git switch my-branch
hint: If you meant to check out a remote tracking branch on, e.g. 'origin',
hint: you can do so by fully qualifying the name with the --track option:
hint:
hint:     git checkout --track origin/<name>
hint:
hint: If you'd like to always have checkouts of an ambiguous <name> prefer
hint: one remote, e.g. the 'origin' remote, consider setting
hint: checkout.defaultRemote=origin in your config.
fatal: 'my-branch' matched multiple (2) remote tracking branches

Of course that works too, but it keeps the user guessing whether the
`--track` option also exists for `git-switch`. Not to mention that
`git-checkout` is now largely superseded by `git-switch` and
`git-restore` and is no longer recommended, as far as I understand it.

So I think it makes sense to either:
1. make the recommended command match the one ran by the user, or
2. always recommend `git-switch` as opposed to `git-checkout`

git version 2.52.0
cpu: x86_64
built from commit: 9a2fb147f2c61d0cab52c883e7e26f5b7948e3ed
sizeof-long: 8
sizeof-size_t: 8
shell-path: /bin/sh
rust: enabled
libcurl: 8.17.0
OpenSSL: OpenSSL 3.6.0 1 Oct 2025
zlib-ng: 2.2.5
SHA-1: SHA1_DC
SHA-256: SHA256_BLK
default-ref-format: files
default-hash: sha1

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-01-27 16:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-27  9:31 Remote tracking option hint for git-switch still shows git-checkout command Simon Cheng
2026-01-27 16:29 ` Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox