diff options
| author | Harald Nordgren <haraldnordgren@gmail.com> | 2026-06-27 18:02:25 +0000 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2026-06-27 19:36:43 -0700 |
| commit | a85a43c4802c124a504c42c63129a97d7f8346c1 (patch) | |
| tree | 55b46547cd10d366b6425be925d70242728685eb /t/t4013/diff.diff_initial..side | |
| parent | 2faf0f0256cbf4cef447202276ca57d36e1d9380 (diff) | |
push: suggest <remote> <branch> for a slash slip
When pushing the 'main' branch to the remote 'origin', i.e.,
$ git push origin main
it is easy to mistakenly write
$ git push origin/main
That is parsed as the repository to push to, and since 'origin/main'
is neither a configured remote nor a path it dies with:
fatal: 'origin/main' does not appear to be a git repository
Often 'origin/main' does not exist as a repository, so the command
fails without doing any harm, but it gives no hint that a space was
meant instead of a slash and can leave the user puzzled.
When the argument is not an existing path or configured remote but
its part before the first slash names one, suggest the intended
'<remote> <branch>' form:
$ git push origin main
The suggestion is shown as advice so it can be silenced with
advice.pushRepoLooksLikeRef.
Signed-off-by: Harald Nordgren <haraldnordgren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t4013/diff.diff_initial..side')
0 files changed, 0 insertions, 0 deletions
