views:

71

answers:

2

There's a bunch of branches on one of my git repo's that I got when I forked it on github. I don't really care for my github fork to have these branches. Is there any way that I can push that will delete all the branches on my github repo that are not in my local repo?

+3  A: 

git push --mirror <origin> will make the refs on the remote match those in the local repository, including deleting branches that you don't have locally.

From git help push:

--mirror
    Instead of naming each ref to push, specifies that all refs under
    refs/ (which includes but is not limited to refs/heads/,
    refs/remotes/, and refs/tags/) be mirrored to the remote
    repository. Newly created local refs will be pushed to the remote
    end, locally updated refs will be force updated on the remote end,
    and deleted refs will be removed from the remote end. This is the
    default if the configuration option remote.<remote>.mirror is set.
mkarasek
+1  A: 

You can delete remote branches my pushing an empty branch:

$ git push origin :branch-to-delete
mipadi
given that there were more than 5 branches... I feel this way is inefficient which is why I'm seeking other options.
xenoterracide