code: func (w *Worktree) Remove(path string) (plumbing.Hash, error) {
  	// TODO(mcuadros): remove plumbing.Hash from signature at v5.
  	idx, err := w.r.Storer.Index()
  	if err != nil {
  		return plumbing.ZeroHash, err
  	}
  
  	var h plumbing.Hash
  
  	fi, err := w.Filesystem.Lstat(path)
  	if err != nil || !fi.IsDir() {
  		h, err = w.doRemoveFile(idx, path)
  	} else {
  		_, err = w.doRemoveDirectory(idx, path)
  	}
  	if err != nil {
  		return h, err
  	}
  
  	return h, w.r.Storer.SetIndex(idx)
  }
docs: // Remove removes files from the working tree and from the index.