当我在GitHub上分叉时,我的git repo上有一堆分支.我不希望我的GitHub fork拥有这些分支.
有什么方法可以删除我的GitHub仓库中不在我本地仓库中的所有分支吗?
git push --mirror
将使远程的refs与本地存储库中的refs匹配,包括删除本地没有的分支.
来自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..mirror is set.