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 want my GitHub fork to have these branches.
Is there any way that I can delete all the branches on my GitHub repo that are not in my local repo?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With