git

package
v0.21.0 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2026 License: MIT Imports: 12 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const ConfirmNo = "No"
View Source
const ConfirmYes = "Yes"

Variables

View Source
var (
	ErrCommandExecutionFailed         = errors.New("command execution failed")
	ErrCouldNotDetermineCurrentBranch = errors.New("could not determine current branch")
	ErrNoBranchesFound                = errors.New("no branches found")
)

Functions

This section is empty.

Types

type Branch

type Branch struct {
	Name    string
	Current bool
	// Only on a remote, with no local branch yet. Name has no remote prefix
	// (feature/x, not origin/feature/x), as checking it out by that name
	// creates a local branch tracking it.
	RemoteOnly bool
}

type BranchChoicesQuery added in v0.20.0

type BranchChoicesQuery struct {
	bus.Returns[[]workspace.Choice]

	Workspace string
	Project   string
}

BranchChoicesQuery lists the branches that can be checked out in the repository: local branches first, then those only on a remote, without their remote prefix. The current branch is left out.

func (BranchChoicesQuery) MessageName added in v0.20.0

func (BranchChoicesQuery) MessageName() string

type Branches

type Branches []Branch

func (Branches) ExcludeCurrent

func (branches Branches) ExcludeCurrent() Branches

func (Branches) Filter

func (branches Branches) Filter(f branchFilterFunc) Branches

func (Branches) GetCurrent

func (branches Branches) GetCurrent() *Branch

func (Branches) Names

func (branches Branches) Names() []string

func (Branches) Search added in v0.20.0

func (branches Branches) Search(search string) Branches

Search returns the branches whose names contain search, ignoring case.

type BranchesQuery added in v0.17.1

type BranchesQuery struct {
	bus.Returns[bus.Void]

	Search string
}

func (BranchesQuery) MessageName added in v0.17.1

func (BranchesQuery) MessageName() string

type CheckoutCommand added in v0.17.1

type CheckoutCommand struct {
	bus.Returns[bus.Void]

	Name        string
	AllProjects bool
	Workspace   string
	Project     string
	Pull        bool
	Rebase      bool
	Create      bool
}

func (CheckoutCommand) MessageName added in v0.17.1

func (CheckoutCommand) MessageName() string

type LoglQuery added in v0.17.1

type LoglQuery struct {
	bus.Returns[bus.Void]

	// The amount of commits to show
	Amount int
	// The directory to run the command in, defaults to the current directory
	Dir string
}

func (LoglQuery) MessageName added in v0.17.1

func (LoglQuery) MessageName() string

type Manager added in v0.17.1

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

func NewManager added in v0.17.1

func NewManager(exec executor, tui tui) *Manager

func (*Manager) BranchChoices added in v0.20.0

func (m *Manager) BranchChoices(ctx context.Context, _ BranchChoicesQuery) ([]workspace.Choice, error)

func (*Manager) Checkout added in v0.17.1

func (m *Manager) Checkout(ctx context.Context, cmd CheckoutCommand) error

func (*Manager) Clone added in v0.17.1

func (m *Manager) Clone(repoURL string, target string, branch string) error

Clone clones the repository into target, checking out the given branch, or the remote's default branch when it's empty.

func (*Manager) DirectoryHasOrigin added in v0.17.1

func (m *Manager) DirectoryHasOrigin(dir string, origin string) (bool, error)

func (*Manager) GetCurrentBranch added in v0.17.1

func (m *Manager) GetCurrentBranch(dir string) (string, error)

func (*Manager) GetRepositoryRootFromPath added in v0.17.1

func (m *Manager) GetRepositoryRootFromPath(path string) (string, error)

func (*Manager) IsIgnored added in v0.21.0

func (m *Manager) IsIgnored(path string) (bool, error)

IsIgnored reports whether git ignores the file at path, in the repository that contains it.

func (*Manager) Logl added in v0.17.1

func (m *Manager) Logl(_ context.Context, query LoglQuery) error

func (*Manager) Pull added in v0.17.1

func (m *Manager) Pull(ctx context.Context, cmd PullCommand) error

func (*Manager) PullBranch added in v0.17.1

func (m *Manager) PullBranch(dto PullBranchOpts) error

func (*Manager) Push added in v0.17.1

func (m *Manager) Push(ctx context.Context, cmd PushCommand) error

func (*Manager) PushBranch added in v0.17.1

func (m *Manager) PushBranch(cmd PushBranchOpts) error

func (*Manager) RebaseInteractively added in v0.17.1

func (m *Manager) RebaseInteractively(_ context.Context, cmd RebaseInteractivelyCommand) error

func (*Manager) RemoteBranchExists added in v0.19.0

func (m *Manager) RemoteBranchExists(repoURL string, branch string) (bool, error)

RemoteBranchExists checks whether the branch exists on the remote repository, without cloning it.

func (*Manager) ShowBranches added in v0.17.1

func (m *Manager) ShowBranches(_ context.Context, query BranchesQuery) error

func (*Manager) Status added in v0.17.1

func (m *Manager) Status(ctx context.Context, query StatusQuery) error

func (*Manager) UndoLastXCommits added in v0.17.1

func (m *Manager) UndoLastXCommits(_ context.Context, cmd UndoLastXCommitsCommand) error

type PullBranchOpts added in v0.17.1

type PullBranchOpts struct {
	// The directory to run the command in, defaults to the current directory
	Dir string
	// Passes --rebase to git pull
	Rebase bool
}

type PullCommand added in v0.17.1

type PullCommand struct {
	bus.Returns[bus.Void]

	AllProjects bool
	Workspace   string
	Project     string
	Rebase      bool
}

func (PullCommand) MessageName added in v0.17.1

func (PullCommand) MessageName() string

type PushBranchOpts added in v0.17.1

type PushBranchOpts struct {
	Force bool
	// The directory to run the command in, defaults to the current directory
	Dir string
}

type PushCommand added in v0.17.1

type PushCommand struct {
	bus.Returns[bus.Void]

	AllProjects bool
	Workspace   string
	Project     string
	Force       bool
}

func (PushCommand) MessageName added in v0.17.1

func (PushCommand) MessageName() string

type RebaseInteractivelyCommand added in v0.17.1

type RebaseInteractivelyCommand struct {
	bus.Returns[bus.Void]

	// The amount of commits to include in the rebase
	Amount int
	// The directory to run the command in, defaults to the current directory
	Dir string
}

func (RebaseInteractivelyCommand) MessageName added in v0.17.1

func (RebaseInteractivelyCommand) MessageName() string

type StatusQuery added in v0.17.1

type StatusQuery struct {
	bus.Returns[bus.Void]

	AllProjects bool
	Workspace   string
	Project     string
}

func (StatusQuery) MessageName added in v0.17.1

func (StatusQuery) MessageName() string

type UndoLastXCommitsCommand added in v0.17.1

type UndoLastXCommitsCommand struct {
	bus.Returns[bus.Void]

	// The amount of commits to remoe
	Amount           int
	SkipConfirmation bool
	// The directory to run the command in, defaults to the current directory
	Dir string
}

func (UndoLastXCommitsCommand) MessageName added in v0.17.1

func (UndoLastXCommitsCommand) MessageName() string

Jump to

Keyboard shortcuts

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