Safer branch checkout.

Source: https://github.com/mathiasbynens/dotfiles/pull/357/files