[prev in list] [next in list] [prev in thread] [next in thread] 

List:       wine-devel
Subject:    Re: How to delete a git branch that's not been merged?
From:       Hin-Tak Leung <htl10 () users ! sourceforge ! net>
Date:       2022-12-16 23:55:34
Message-ID: 109539038.1606762.1671235326103 () mail ! yahoo ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


 You can just push empty to delete remote branch (note the nothing before ":"):
git push origin :branch_name
The normal push is equivalent to (your current HEAD is branched from remote "branch_name")
git push origin HEAD:branch_name





    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:
> https://wiki.winehq.org/Git_Wine_Tutorial#Deleting_branches has
> 
>   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


  
[Attachment #5 (text/html)]

<html><head></head><body><div class="ydpb98d7dceyahoo-style-wrap" \
style="font-family:Helvetica Neue, Helvetica, Arial, \
sans-serif;font-size:16px;"><div></div>  <div>You can just push empty to delete \
remote branch (note the nothing before ":"):</div><div><br></div><div>git push origin \
:branch_name</div><div><br></div><div>The normal push is equivalent to (your current \
HEAD is branched from remote "branch_name")</div><div><br></div><div>git push origin \
HEAD:branch_name</div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div>
  
        <div id="ydpb98d7dceyahoo_quoted_1276466017" class="ydpb98d7dceyahoo_quoted">
            <div style="font-family:'Helvetica Neue', Helvetica, Arial, \
sans-serif;font-size:13px;color:#26282a;">  
                <div>
                    On Saturday, 17 December 2022 at 05:51:25 GMT+8, Gerald Pfeifer \
&lt;gerald@pfeifer.com&gt; wrote:  </div>
                <div><br></div>
                <div><br></div>
                <div><div dir="ltr">On Tue, 13 Dec 2022, Gerald Pfeifer \
wrote:<br></div><div dir="ltr">&gt; <a \
href="https://wiki.winehq.org/Git_Wine_Tutorial#Deleting_branches " rel="nofollow" \
target="_blank">https://wiki.winehq.org/Git_Wine_Tutorial#Deleting_branches \
</a>has<br></div><div dir="ltr">&gt; <br></div><div dir="ltr">&gt;&nbsp;  Deleting \
branches<br></div><div dir="ltr">&gt; <br></div><div dir="ltr">&gt;&nbsp;  git branch \
-D new-branch<br></div><div dir="ltr">&gt; <br></div><div dir="ltr">&gt; Alas that \
does not work for me.<br></div><div dir="ltr">&gt; <br></div><div \
dir="ltr">&gt;&nbsp;  % git branch -a<br></div><div dir="ltr">&gt;&nbsp;  * \
master<br></div><div dir="ltr">&gt;&nbsp; &nbsp;  remotes/origin/HEAD -&gt; \
origin/master<br></div><div dir="ltr">&gt;&nbsp; &nbsp;  \
remotes/origin/dll_soinit.c-stddef.h<br></div><div dir="ltr">:<br></div><div \
dir="ltr">&gt; <br></div><div dir="ltr">&gt;&nbsp;  % git branch -D \
dll_soinit.c-stddef.h<br></div><div dir="ltr">&gt;&nbsp;  error: branch \
'dll_soinit.c-stddef.h' not found.<br></div><div dir="ltr"><br></div><div dir="ltr">I \
believe I can now answer my own question, having dug into it a bit.<br></div><div \
dir="ltr"><br></div><div dir="ltr">The invocation above is for *local* branches, \
branches in the local<br></div><div dir="ltr">checkout.<br></div><div \
dir="ltr"><br></div><div dir="ltr">To remove a *remote* branch, for example where a \
merge request was not <br></div><div dir="ltr">accepted or was "bad" for some reason, \
we need to use `git push` instead <br></div><div dir="ltr">of `git \
branch`:<br></div><div dir="ltr"><br></div><div dir="ltr">&nbsp; % git push origin \
--delete dll_soinit.c-stddef.h<br></div><div dir="ltr"><br></div><div dir="ltr">I \
plan on adding this to the Wiki in a few days. <br></div><div dir="ltr">Any \
suggestions/concerns?<br></div><div dir="ltr"><br></div><div \
dir="ltr">Gerald<br></div><div dir="ltr"><br></div><div dir="ltr"><br></div></div>  \
</div>  </div></div></body></html>





[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic