How can I keep a git mirror in sync (including deleting branches)?
I've cloned a git repo using git clone --mirror
, and I'd like to keep the mirror up to date. So far, I've been using git fetch --all
, but I've noticed that branches deleted in the original repo are not deleted in the mirrored repo. I've looked at How to update a git clone --mirror
? but my attempt at using git remote update
didn't appear to work - branches that were deleted in the original repo are still vis开发者_如何学Cible in the mirrored repo.
Use git remote prune remoteName
to remove the remote branches.
You can also add the --prune
tag to git remote update
I go one step further and configure it globally:
git config --global fetch.prune true
精彩评论