On Saturday, 17 December 2022 at 05:51:25 GMT+8, Gerald Pfeifer <gerald@pfeifer.com> wrote:
On Tue, 13 Dec 2022, Gerald Pfeifer wrote:
>
> Deleting branches
>
> git branch -D new-branch
>
> Alas that does not work for me.
>
> % git branch -a
> * master
> remotes/origin/HEAD -> origin/master
> remotes/origin/dll_soinit.c-stddef.h
:
>
> % git branch -D dll_soinit.c-stddef.h
> error: branch 'dll_soinit.c-stddef.h' not found.
I believe I can now answer my own question, having dug into it a bit.
The invocation above is for *local* branches, branches in the local
checkout.
To remove a *remote* branch, for example where a merge request was not
accepted or was "bad" for some reason, we need to use `git push` instead
of `git branch`:
% git push origin --delete dll_soinit.c-stddef.h
I plan on adding this to the Wiki in a few days.
Any suggestions/concerns?
Gerald