Skip to content

Suggest the intended form when a remote/branch slip is given#2147

Closed
HaraldNordgren wants to merge 2 commits into
gitgitgadget:masterfrom
HaraldNordgren:suggest-remote-branch-slips
Closed

Suggest the intended form when a remote/branch slip is given#2147
HaraldNordgren wants to merge 2 commits into
gitgitgadget:masterfrom
HaraldNordgren:suggest-remote-branch-slips

Conversation

@HaraldNordgren

@HaraldNordgren HaraldNordgren commented Jun 11, 2026

Copy link
Copy Markdown

No description provided.

@HaraldNordgren HaraldNordgren force-pushed the suggest-remote-branch-slips branch 15 times, most recently from a5619a7 to 1ca9ca4 Compare June 11, 2026 18:13
"git branch --set-upstream-to origin main" reads the trailing word as
the local branch to operate on and dies with "branch 'main' does not
exist", pointing at the wrong problem.

When that branch is missing and "<remote>/<branch>" names a real
remote-tracking ref, suggest the intended
"git branch --set-upstream-to=<remote>/<branch>" form.

Signed-off-by: Harald Nordgren <haraldnordgren@gmail.com>
"git push origin/main" is treated as a repository and dies with
"'origin/main' does not appear to be a git repository", with no hint
that a space was meant instead of a slash.

When the argument is not an existing path or configured remote but its
part before the first slash names one, suggest the intended
"git push <remote> <branch>" form. The suggestion is shown as advice so
it can be silenced with advice.pushRepoLooksLikeRef.

Signed-off-by: Harald Nordgren <haraldnordgren@gmail.com>
@HaraldNordgren HaraldNordgren force-pushed the suggest-remote-branch-slips branch from 1ca9ca4 to 59eaa50 Compare June 11, 2026 18:18
@HaraldNordgren

Copy link
Copy Markdown
Author

Closing; reopening against git/git.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant