func (g *CommitsService) lastOne(commits []string, revision string) (string, error) {
	if revision == "" {
		return "", errors.New("no revision specified")
	}
	if len(commits) == 0 {
		return "", errors.New("no commits")
	}
	return commits[1], nil
}
Last returns the hash of the previous commit of the given commit
package github
import (
	"context"
	"errors"
	"strconv"
	"strings"
	"github.com/google/go-github/github"
)
type CommitsService service
func (g *CommitsService) List(revision string) ([]string, error) {
	if revision == "" {
		return []string{}, errors.New("no revision specified")
	}
	var s []string
	commits, _, err := g.client.API.RepositoriesListCommits(
		context.Background(),
		&github.CommitsListOptions{SHA: revision},
	)
	if err != nil {
		return s, err
	}
	for _, commit := range commits {
		s = append(s, *commit.SHA)
	}
	return s, nil
}