This script automates the process of synchronizing a Git repository by ensuring all remote branches are tracked locally, pulling updates with fast-forward-only behavior, updating submodules (when present), and optionally deleting local branches that no longer exist on the remote.
- Clones the repo (with submodules) if not already present
- Fetches and prunes all remote branches
- Tracks all
origin/*
branches as local branches if missing - Checks out each branch: