Update sync workflow to not create stray branches

Change-Id: I8078f8c9b6a8ddd45a927b49f533f041ae6adecf
diff --git a/.github/workflows/sync-to-gerrit.yaml b/.github/workflows/sync-to-gerrit.yaml
index ee64d7c..b267be9 100644
--- a/.github/workflows/sync-to-gerrit.yaml
+++ b/.github/workflows/sync-to-gerrit.yaml
@@ -21,8 +21,7 @@
         env:
           GERRIT_URL: https://ceres-solver.googlesource.com/ceres-solver
         run: |
-          git remote add gerrit "$GERRIT_URL"
-          git fetch gerrit --prune --tags
+          git fetch "$GERRIT_URL" "+refs/heads/*:refs/gerrit/heads/*" --prune --tags
 
-          git push origin "+refs/remotes/gerrit/*:refs/heads/*"
-          git push origin --tags --force
+          git push origin "+refs/gerrit/heads/*:refs/heads/*" :refs/heads/HEAD
+          git push origin --tags --force
\ No newline at end of file