Help us shape the future of Go! Take the 2026 Go Developer Survey

git

package
v0.13.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 2, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HookPrepareCommitMessageFile     = "prepare-commit-msg"
	HookPrepareCommitMessageTemplate = `#!/bin/sh

if [[ "$2" != "message" && "$2" != "commit" ]]; then
  ai commit --file $1 --preview --no-confirm
fi
`
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Command

type Command struct {
	// contains filtered or unexported fields
}

func New

func New(opts ...Option) *Command

func (*Command) AddFiles added in v0.1.9

func (c *Command) AddFiles(files []string) error

func (*Command) Commit

func (c *Command) Commit(val string) (string, error)

func (*Command) CommitWithAuthor added in v0.13.8

func (c *Command) CommitWithAuthor(val, authorName, authorEmail string) (string, error)

func (*Command) CommitWithAuthorAndCommitter added in v0.13.8

func (c *Command) CommitWithAuthorAndCommitter(val, authorName, authorEmail, committerName, committerEmail string) (string, error)

func (*Command) DiffFiles

func (c *Command) DiffFiles() (string, error)

DiffFiles compares the differences between two sets of data.

func (*Command) FormatDiff added in v0.12.0

func (c *Command) FormatDiff(diffOutput string) string

FormatDiff formats git diff output with color and stats

func (*Command) GitDir

func (c *Command) GitDir() (string, error)

GitDir to show the (by default, absolute) path of the git directory of the working tree.

func (*Command) InstallHook

func (c *Command) InstallHook() error

func (*Command) ListAllFiles added in v0.1.6

func (c *Command) ListAllFiles() ([]string, error)

func (*Command) RollbackLastCommit added in v0.1.9

func (c *Command) RollbackLastCommit() error

RollbackLastCommit rolls back the most recent commit, leaving changes staged.

func (*Command) UninstallHook

func (c *Command) UninstallHook() error

type DiffStats added in v0.12.0

type DiffStats struct {
	Added      int
	Removed    int
	Total      int
	Context    int
	FileHeader string
}

DiffStats holds statistics about the diff

type Option

type Option interface {
	// contains filtered or unexported methods
}

Option is an interface that specifies instrumentation configuration options.

func WithDiffUnified

func WithDiffUnified(val int) Option

WithDiffUnified is a function that generate diffs with <n> lines of context instead of the usual three.

func WithEnableAmend

func WithEnableAmend(val bool) Option

WithEnableAmend returns an Option that sets the isAmend field of a config object to the given value.

func WithExcludeList

func WithExcludeList(val []string) Option

WithExcludeList returns an Option that sets the excludeList field of a config object to the given value.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL