git

package
v0.1.0-alpha.33 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2026 License: MPL-2.0 Imports: 9 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

Overview

Package git provides helpers for SCM.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HasGPGSignature

func HasGPGSignature(commit *object.Commit) bool

HasGPGSignature returns true if the commit is signed.

func OpenRepository

func OpenRepository(path string) (*git.Repository, error)

OpenRepository opens the repository containing path, including linked worktrees whose .git entry is a gitdir file.

func ReadArmoredKeyrings

func ReadArmoredKeyrings(armoredKeyrings []string) (openpgp.EntityList, error)

ReadArmoredKeyrings parses a list of armored keyrings into a single keyring.

func VerifyPGPSignature

func VerifyPGPSignature(commit *object.Commit, keyring openpgp.EntityList) (*openpgp.Entity, error)

VerifyPGPSignature validates the commit PGP signature against a keyring.

Types

type Git

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

Git is a helper for git.

func NewGit

func NewGit() (*Git, error)

NewGit instantiates and returns a Git struct.

func (*Git) AheadBehind

func (g *Git) AheadBehind(ref string) (ahead, behind int, err error)

AheadBehind returns the number of commits that HEAD is ahead and behind relative to the specified ref.

func (*Git) CheckoutPullRequest

func (g *Git) CheckoutPullRequest(number int) (err error)

CheckoutPullRequest checks out pull request.

func (*Git) Commits

func (g *Git) Commits(commit1, commit2 string) ([]*object.Commit, error)

Commits returns the list of commits in the range commit1..commit2: the commits reachable from commit2 which are not reachable from commit1 (as `git log commit1..commit2`).

All parents of merge commits are followed, so commits merged into the range are included. The commits are returned newest first (breadth-first order starting from commit2).

func (*Git) FetchPullRequest

func (g *Git) FetchPullRequest(remote string, number int) (err error)

FetchPullRequest fetches a remote PR.

func (*Git) HeadCommit

func (g *Git) HeadCommit() (*object.Commit, error)

HeadCommit returns the commit HEAD points to.

func (*Git) Message

func (g *Git) Message() (message string, err error)

Message returns the commit message. In the case that a commit has multiple parents, the message of the last parent is returned.

func (*Git) SHA

func (g *Git) SHA() (sha string, err error)

SHA returns the sha of the current commit.

Jump to

Keyboard shortcuts

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