func (g *Git) Changes() (bool, error) {
	cmd := exec.Command("git", "status", "-s")
	stdOut, err := g.run(cmd)
	return len(stdOut) > 0, err
}
Changes detect if any changes has been made in the directory
package cmdgit
import (
	"bytes"
	"fmt"
	"os/exec"
	"regexp"
	"strings"
	"github.com/lindell/multi-gitter/internal/git"
	"github.com/pkg/errors"
	log "github.com/sirupsen/logrus"
)
type Git struct {
	Directory  string  
	FetchDepth int     
}
var errRe = regexp.MustCompile(`(^|\n)(error|fatal): (.+)`)
func (g *Git) run(cmd *exec.Cmd) (string, error) {
	stderr := &bytes.Buffer{}
	stdout := &bytes.Buffer{}
	cmd.Dir = g.Directory
	cmd.Stderr = stderr
	cmd.Stdout = stdout
	err := cmd.Run()
	if err != nil {
		matches := errRe.FindStringSubmatch(stderr.String())
		if matches != nil {
			return "", errors.New(matches[3])
		}
		msg := fmt.Sprintf(`git command existed with %d`,
			cmd.ProcessState.ExitCode(),
		)
		return "", errors.New(msg)
	}
	return stdout.String(), nil
}
func (g *Git) Clone(url string, baseName string) error {
	args := []string{"clone", url, "--branch", baseName, "--single-branch"}
	if g.FetchDepth > 0 {
		args = append(args, "--depth", fmt.Sprint(g.FetchDepth))
	}
	args = append(args, g.Directory)
	cmd := exec.Command("git", args...)
	_, err := g.run(cmd)
	return err
}
func (g *Git) ChangeBranch(branchName string) error {
	cmd := exec.Command("git", "checkout", "-b", branchName)
	_, err := g.run(cmd)
	return err
}