In my current repo I have the following output:
$ git branch -a
* master
remotes/origin/master
remotes/public/master
I want to delete remotes/public/master
from the branch list:
$ git branch -d remotes/public/master
error: branch 'remotes/public/master' not found.
Also, the output of git remote
is strange, since it does not list public
:
$ git remote show
origin
How can I delete 'remotes/public/master' from the branch list?
Update, tried the git push
command:
$ git push public :master
fatal: 'public' does not appear to be a git repository
fatal: The remote end hung up unexpectedly
Best Answer
You might be needing a cleanup:
or you might be needing a prune:
However, it appears these should have been cleaned up earlier with
So it might be you hand-edited your config file and this did not occur, or you have privilege problems.
Maybe run that again and see what happens.
Advice Context
If you take a look in the revision logs, you'll note I suggested more "correct" techniques, which for whatever reason didn't want to work on their repository.
I suspected the OP had done something that left their tree in an inconsistent state that caused it to behave a bit strangely, and
git gc
was required to fix up the left behind cruft.Usually
git branch -rd origin/badbranch
is sufficient for nuking a local tracking branch , orgit push origin :badbranch
for nuking a remote branch, and usually you will never need to callgit gc