Robust handling for existing git repos

If a repository was downloaded previously, it may contain
local changes that prevent git checkout. Do git clean -xdfq
and git reset --hard.

If a repository was downloaded previously, it may contain
a branch with the same name we want to use. To be compatible
with old git, we drop the branch and create again.

Change-Id: Ib46328e9cddc8d1e58833c08b65679b1b61a891d