When 'git switch' cannot write tracking config, for example because .git/config.lock exists, it prints a hint to run 'git branch --set-upstream-to=origin/refs/heads/feat'. The correct name is origin/feat, and the printed command fails because the full ref name is not a valid remote-tracking branch name. Patch 1 strips refs/heads/ from the hint.
The original series had two more patches. Patch 2 makes setup_tracking() return an error instead of calling exit(1), with no behavior change on its own. Patch 3 makes 'git switch -c' and 'git checkout -b' complete the switch and exit with status 0 when tracking cannot be written, matching push -u, clone and fetch, which print the error and continue. Today, the worktree, index and new branch ref are updated but HEAD stays on the old branch and the changes remain staged. 'git branch' would still fail.
Junio C Hamano asked whether the two later patches belong to the same topic as the first, or whether contention over them should hold up the hint fix. The author checked that patch 1 stands alone, that 2 applies without it, and that 3 conflicts only in a t3200 test placement. The author then resent patches 2 and 3 as a separate two-patch series.
Harald Nordgren called it a very nice find but asked for the test to compare the full multi-line hint, since the hint text is the point of the topic. The author's v2 changes note says the test now compares the whole hint message.
The hint fix appears ready to be taken on its own, while the checkout behavior change awaits review.