Run git checkout only if in another branch