Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fix stale git branch -r (delete phantom git branches)?

Tags:

git

$ git branch   develop * feature/bug_76   master $ git branch -r   origin/HEAD -> origin/master   origin/develop   origin/feature/implement_IBResponder   origin/master   origin/origin   origin/sculptor_strategy 

Locally, I am good. I want to delete all the crud on origin so I try:

$ git push origin :origin/sculptor_strategy error: unable to delete 'origin/sculptor_strategy': remote ref does not exist error: failed to push some refs to 'git@gitlab:pitbull.git' 

What am I doing wrong?

(Wild Guess) Is some local cache of what's on origin stale?

ANSWER

It turned out to be a red-herring - the problem was, my local cache was stale, as I suspected. Both answers below will work fine.

like image 442
kfmfe04 Avatar asked May 28 '13 07:05

kfmfe04


1 Answers

You are probably not fetching with the prune option enabled. Use: git fetch --prune.

like image 159
pmr Avatar answered Sep 24 '22 10:09

pmr