Don't delete the branch config when switching branches.

The fix for issue #46 in 5d016502ebc6 appears to break syncing in some
situations: the branch is deleted after the point where it's been
configured, which deletes part of its configuration and causes the
config to change each time you call `repo init`, alternating between a
configuration that works and one that doesn't.

Instead of deleting the branch with git branch -D, use git update-ref -d
which just deletes the ref (to avoid the rebase) without touching the
configuration for the branch that was set up during the first repo init.

This appears to ensure the config is left in a valid state all the time
no matter what combination of repo init commands you run, without
reintroducing the rebasing issue.

Change-Id: Iaadaa6e56a46840bbc593fa5b35cb5b34cd3ce69
diff --git a/ b/
index 114ff49..66a123d 100644
--- a/
+++ b/
@@ -2181,7 +2181,7 @@
     return GitCommand(self,
-                        ['branch', '-D', 'default'],
+                        ['update-ref', '-d', 'refs/heads/default'],
                         capture_stdout = True,
                         capture_stderr = True).Wait() == 0