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 visible in the mirrored repo.
This is because "git pull" does not remove remote tracking branches for branches deleted from remote repo.
You first have to get the original Git repository on your machine. Then, go into the repository. Finally, use the --mirror flag to copy everything in your local Git repository into the new repo.
git-sync is a simple command that pulls a git repository into a local directory. It is a perfect "sidecar" container in Kubernetes - it can periodically pull files down from a repository so that an application can consume them.
Use git remote prune remoteName
to remove the remote branches.
You can also add the --prune
tag to git remote update
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