git

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckoutBranch

func CheckoutBranch(branch string) error

CheckoutBranch checks out the given branch, creating it if necessary.

func CurrentBranch

func CurrentBranch() (string, error)

CurrentBranch returns the currently checked-out branch name.

func DefaultBranch

func DefaultBranch(remote string) (string, error)

DefaultBranch returns the default branch of the repository (usually main or master).

func TopLevelDir

func TopLevelDir() (string, error)

TopLevelDir returns the top-level directory of the current git repository.

Types

type Remote

type Remote struct {
	Name     string
	FetchURL string
	PushURL  string
	Host     string
	Owner    string
	Repo     string
}

Remote represents a git remote.

func FindRemote

func FindRemote(remoteName, host string) (*Remote, error)

FindRemote finds a remote matching the given host.

func Remotes

func Remotes() ([]Remote, error)

Remotes returns all configured git remotes for the current repository.

Jump to

Keyboard shortcuts

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