Note that there are some explanatory texts on larger screens.

plurals
  1. POUnable to delete or prune a remote branch with no commits
    primarykey
    data
    text
    <p>I accidentally created a branch and pushed it to the origin. I created it out of another branch, but didn't commit any changes, so it should be "identical" to the original branch.</p> <p>I want to remove the branch, so I first removed it locally with:</p> <pre><code>git branch -d &lt;branch_name&gt; </code></pre> <p>and then I wanted to remove from the remote location with:</p> <pre><code>git push origin :&lt;branch_name&gt; </code></pre> <p>but this gave me the error:</p> <blockquote> <p>error: unable to push to unqualified destination: The destination refspec neither matches an existing ref on the remote nor begins with refs/, and we are unable to guess a prefix based on the source ref. fatal: The remote end hung up unexpectedly</p> </blockquote> <p>I found information about this error on another thread in StackOverflow (<a href="https://stackoverflow.com/questions/2895906/cannot-delete-a-remote-branch-created-unintentionally">Cannot delete a remote branch created unintentionally</a>) and on other sites (<a href="http://stay-calm.blogspot.com/2009/02/git-prune-to-remove-old-remote-tracking.html" rel="nofollow noreferrer">git: prune to remove old remote tracking branches</a>), but the solution they propose:</p> <pre><code>git remote prune origin </code></pre> <p>does not work for me. The prunning command exits correctly, but <strong>I still see the branch</strong> when I <code>git branch -r</code> or <code>git branch -a</code>.</p> <p>I have also tried <code>git remote update</code> and <code>git fetch</code> but that didn't change anything.</p> <p>How can I remove this branch from the list of branches?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload