code: func (o *CheckoutOptions) Validate() error {
  	if !o.Create && !o.Hash.IsZero() && o.Branch != "" {
  		return ErrBranchHashExclusive
  	}
  
  	if o.Create && o.Branch == "" {
  		return ErrCreateRequiresBranch
  	}
  
  	if o.Branch == "" {
  		o.Branch = plumbing.Master
  	}
  
  	return nil
  }
docs: // Validate validates the fields and sets the default values.