pkg/state/git/impl.go
func (git *JSONGitStore) Commit(c *cluster.Cluster) error {
	if c == nil {
		return fmt.Errorf("Nil cluster spec")
	}
	bytes, err := json.Marshal(c)
	if err != nil {
		return err
	}

	//writes latest changes to git repo.
	git.Write(state.ClusterJSONFile, bytes)

	//commits the changes
	r, err := g.NewFilesystemRepository(state.ClusterJSONFile)
	if err != nil {
		return err
	}

	// Add a new remote, with the default fetch refspec
	_, err = r.CreateRemote(&config.RemoteConfig{
		Name: git.ClusterName,
		URL:  git.options.CommitConfig.Remote,
	})
	_, err = r.Commits()
	if err != nil {
		return err
	}
	return nil
}
func (git *JSONGitStore) Commit(c *cluster.Cluster) error {
	if c == nil {
		return fmt.Errorf("Nil cluster spec")
	}
	bytes, err := json.Marshal(c)
	if err != nil {
		return err
	}

	//writes latest changes to git repo.
	git.Write(state.ClusterJSONFile, bytes)

	//commits the changes
	r, err := g.NewFilesystemRepository(state.ClusterJSONFile)
	if err != nil {
		return err
	}

	// Add a new remote, with the default fetch refspec
	_, err = r.CreateRemote(&config.RemoteConfig{
		Name: git.ClusterName,
		URL:  git.options.CommitConfig.Remote,
	})
	_, err = r.Commits()
	if err != nil {
		return err
	}
	return nil
}
//Performs a git 'commit' and 'push' of the current cluster changes.