I have a bare public repo.
The problem is that I’m already using it for a long time and that means that there is a lot of junk in the bare repo. There are tons of dead branches, removed tags, etc…
Is there some command to cleanup the bare repo? Some like git remote prune that works for the opposite scenario?
Edit: Since there seems to be some confusion. This is my setup:
DevelMachine1
^
|
v
MainDevelRepo <-> MainRepo -> PublicBareRepo (with a lot of junk) -> The World
^
|
v
DevelMachine2
After even some more info:
So the problem is here. Once in a while you do a push from MainRepo to PublicBareRepo, which now contains stuff that are no longer valid and shouldn’t be there. In the future, make sure that you only push up branches that should be there. I guess the main thing now is to remove branches from it, and then I have to step back to my original answer (assuming we are talking about the same kind of junk)
After some more information from the OP:
It seems it’s the repo design thats causing problems and a –mirror is the way to solve this. If A is the main bare repo that devs are pushing their stuff to, and if B is a public bare repo, then B should be a clone of A with the –mirror option.
What needs to be done is to do “git remote update” (assuming B already is a mirror of A) on B so it will update itself to again be identical to A.
Original answer:
If you want to remove a branch on the remote repository you can do:
The same goes for any ref really, e.g. for a tag: