Files
git/builtin
Harald Nordgren 35d04b7c30 branch: suggest <remote>/<branch> on upstream slip
When setting the upstream of the current branch to the 'main' branch
of the remote 'origin', i.e.,

    $ git branch --set-upstream-to origin/main

it is easy to mistakenly write

    $ git branch --set-upstream-to origin main

That is parsed as a request to set the upstream of the local branch
'main' to 'origin'. When 'main' does not exist, the command dies
with:

    fatal: branch 'main' does not exist

pointing at a branch the user never meant to name.

When the operated-on branch is missing and '<remote>/<branch>' names
a real remote-tracking ref, suggest the intended form:

    $ git branch --set-upstream-to=origin/main

The suggestion is gated on '<remote>/<branch>' existing so it only
appears when a slipped slash is the likely explanation.

Signed-off-by: Harald Nordgren <haraldnordgren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-06-24 15:21:11 -07:00
..
2026-04-10 07:58:53 -07:00
2026-06-09 10:04:50 +09:00
2026-06-09 10:04:50 +09:00
2026-04-08 10:19:17 -07:00
2026-06-07 23:58:24 +09:00
2026-06-09 10:04:50 +09:00
2026-05-13 00:48:42 +09:00
2026-05-27 14:15:44 +09:00
2026-03-23 08:33:10 -07:00
2026-06-15 07:42:00 -07:00
2026-05-04 10:11:17 +09:00
2026-03-23 08:33:10 -07:00
2026-03-31 20:43:14 -07:00
2026-02-20 08:13:58 -08:00
2026-03-31 20:43:14 -07:00
2026-03-24 12:31:31 -07:00
2026-05-06 09:48:28 +09:00
2026-04-10 07:58:53 -07:00