]> git.ipfire.org Git - thirdparty/git.git/commit
branch: improve error log on branch not found by checking remotes refs
authorClement Mabileau <mabileau.clement@gmail.com>
Wed, 5 Apr 2023 11:43:20 +0000 (11:43 +0000)
committerJunio C Hamano <gitster@pobox.com>
Thu, 6 Apr 2023 20:11:26 +0000 (13:11 -0700)
commit4c643fb321db00a9c79e2dcd1fd033681333584b
tree5810a441da4e343975facca1d61fd1b92f086e36
parentae73b2c8f1da39c39335ee76a0f95857712c22a7
branch: improve error log on branch not found by checking remotes refs

New git users may want to locally delete remote-tracking branches but
don't really understand how they are distinguished from branches by git.
Then one may naively try:
`git branch -d foo/bar` and get a correct error `branch foo/bar not
found` but hard to understand for a newbie, this patch aims to guide one
in such case.

when failing to delete a branch with `git branch -d <branch>` because
of branch not found, try to find a **remote refs** matching `<branch>`
and if so, add an hint:
`Did you forget --remote?` to the error message

Signed-off-by: Clement Mabileau <mabileau.clement@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/branch.c