开发者

How can I keep a git mirror in sync (including deleting branches)?

开发者 https://www.devze.com 2023-03-28 01:18 出处:网络
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

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
0

精彩评论

暂无评论...
验证码 换一张
取 消