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

git

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RemoteStatusSync     = "sync"
	RemoteStatusGone     = "deleted"
	RemoteStatusAhead    = "ahead"
	RemoteStatusBehind   = "behind"
	RemoteStatusConflict = "conflict"
	RemoteStatusDetached = "detached"
	RemoteStatusNone     = "none"
)

Variables

View Source
var (
	Default = &Options{}

	QuietOutput = &Options{QuietStderr: true}

	Mute = &Options{
		QuietStderr: true,
		QuietCmd:    true,
	}
)
View Source
var ErrNotGit = errors.New("you are not int a git repository")

Functions

func Checkout

func Checkout(name string, create bool, opts *Options) error

func Clone

func Clone(url, path string, opts *Options) error

func Config

func Config(name, value string, opts *Options) error

func CreateTag added in v0.1.0

func CreateTag(tag string, opts *Options) error

func DeleteTag added in v0.1.0

func DeleteTag(tag string, opts *Options) error

func EnsureCurrent

func EnsureCurrent() (string, error)

func EnsureNoUncommitted

func EnsureNoUncommitted(opts *Options) error

func EnsurePath

func EnsurePath(dir string) error

func Exec

func Exec(args []string, opts *Options) error

func Fetch

func Fetch(remote string, branch, tag bool, opts *Options) error

func GetCurrentBranch

func GetCurrentBranch(opts *Options) (string, error)

func GetDefaultBranch added in v0.5.0

func GetDefaultBranch(remote string, opts *Options) (string, error)

func ListCommitsBetween added in v0.4.0

func ListCommitsBetween(target string, opts *Options) ([]string, error)

func ListLocalBranchNames added in v0.1.0

func ListLocalBranchNames(current bool, opts *Options) ([]string, error)

func ListRemoteBranches

func ListRemoteBranches(remote string, locals []*BranchDetail, opts *Options) ([]string, error)

func ListRemotes

func ListRemotes(opts *Options) ([]string, error)

func ListTags added in v0.1.0

func ListTags(opts *Options) ([]string, error)

func Output

func Output(args []string, opts *Options) (string, error)

func OutputItems

func OutputItems(args []string, opts *Options) ([]string, error)

func Pull added in v0.4.0

func Pull(opts *Options) error

func PushTag added in v0.1.0

func PushTag(tag string, remote string, remove bool, opts *Options) error

func SetRemoteURL

func SetRemoteURL(remote, url string, opts *Options) error

func Switch added in v0.1.0

func Switch(local, target string, opts *Options) error

Types

type BranchDetail

type BranchDetail struct {
	Name string

	RemoteStatus string

	Current bool

	IsRemote bool
	Remote   string

	Commit    string
	CommitMsg string
}

func ListLocalBranches

func ListLocalBranches(opts *Options) ([]*BranchDetail, error)

func ParseBranchDetail

func ParseBranchDetail(line string) (*BranchDetail, error)

type DiscoverDir added in v0.2.0

type DiscoverDir struct {
	Name string
	Path string
}

func Discover added in v0.2.0

func Discover(rootDir string) ([]*DiscoverDir, error)

type ExecError

type ExecError struct {
	Stderr string

	Err error

	Cmd string

	Opts *Options
}

func (*ExecError) Error

func (e *ExecError) Error() string

func (*ExecError) Extra

func (e *ExecError) Extra()

func (*ExecError) Out added in v0.3.0

func (e *ExecError) Out() string

type Options

type Options struct {
	QuietCmd bool

	QuietStderr bool

	Path string

	NoTrimLines bool
}

type UncommittedChangeError

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

func (*UncommittedChangeError) Error

func (e *UncommittedChangeError) Error() string

Jump to

Keyboard shortcuts

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