Rewrite checkout:error:, add detached head test