Removing branches from github

About 3 weeks ago, I deleted several branches from my local repository, but I never deleted them from my repository on GitHub. I need to clear some of these branches, but they were unsuccessful.

As an example, I deleted this thread from my local 3 weeks ago: 1234e-proj

Now I am trying to run:

 git push origin :1234e-proj 

and I get this error:

 error: unable to push to unqualified destination: 1234e-proj 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. error: failed to push some refs to 

Any idea what I'm doing wrong? This happens with several branches that I have already deleted on my local server.

+4
source share
2 answers

You tried to use

 git push --delete origin '1234e-proj' 

or

 git push --mirror origin # warning: pushes all refs and deletes all others! 

Otherwise, it should work. Perhaps you can share the output

 git branch -a 
+1
source

First of all, a wild hunch: are these branches actually located in the GitHub repository visible on the Internet, or do you just see them as remote branches in your repo? (Run git remote update --prune to update anything that will cut them if they are only in your local repo.)

Use git ls-remote origin to print links on the remote control, since the remote sees them, for example:

 406da7803217998ff6bf5dc69c55b1613556c2f4 HEAD 1e501a7c47ad5ada53d3b1acfb9f131f76e969ec refs/heads/maint 406da7803217998ff6bf5dc69c55b1613556c2f4 refs/heads/master 56e79320f3d9b044c380dfebf136584aaa17ac5b refs/heads/next ... 

Find the ones you want to remove, then use git push :<ref> to delete, for example. git push :refs/heads/branch-foo .

I'm not quite sure what is happening for you, but assuming that refs do exist on the remote control, this should be a reliable way to see and delete them. My best guess is that the links you see on GitHub are not actually in the refs/heads , so using an unqualified name does not work. (I'm not sure how you would find yourself in this situation!

+1
source

Source: https://habr.com/ru/post/1384366/


All Articles