Use setAsHEAD() instead of updateHEAD()

setAsHEAD() does actually the same as updateHEAD(), just that it refuses
to set a detached HEAD to a remote branch.