Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8625823
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T07:52:18+00:00 2026-06-12T07:52:18+00:00

I accidentally created a branch and pushed it to the origin. I created it

  • 0

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.

I want to remove the branch, so I first removed it locally with:

git branch -d <branch_name>

and then I wanted to remove from the remote location with:

git push origin :<branch_name>

but this gave me the error:

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

I found information about this error on another thread in StackOverflow (Cannot delete a remote branch created unintentionally) and on other sites (git: prune to remove old remote tracking branches), but the solution they propose:

git remote prune origin

does not work for me. The prunning command exits correctly, but I still see the branch when I git branch -r or git branch -a.

I have also tried git remote update and git fetch but that didn’t change anything.

How can I remove this branch from the list of branches?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T07:52:20+00:00Added an answer on June 12, 2026 at 7:52 am

    Try git fetch --prune origin.

    Otherwise you could manually remove the branch from your local repository and see if it comes back on git fetch (in which case it wasn’t removed on the remote):

    git branch -d -r origin/branch
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I accidentally created a branch called remotes/origin/remotes/origin/aclark and can't delete it with: git branch
I'm trying to help out a coworker who accidentally created one feature branch from
We accidentally merged branch XYZ into DEV and pushed it to the origin repo.
I accidentally created following check, that works fine, but I'm curious why :) First
I have lost a branch accidentally. I guess it is in reflog list, but
I've accidentally unhitched my master branch from tracking origin master I think. It used
I accidentally did a hg pull and it created a branch in my local
I had created a local throw-away branch temp , and accidentally called git push
Oops. I use mongoose, and accidentally created a collection stats. I didn't realize this
While attempting to create a replacement tablespace for USER, I accidentally created a datafile

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.