Currently this script is using git pull for syncing remote, it will be break when there is a bad commit or git history rewrite. Use git fetch origin main first then git reset --hard FETCH_HEAD to make sure we ignore those bad commits.
<rdar://problem/94832695>