git

package
v1.121.0 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2024 License: MPL-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package git provides simple git repository access.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Repo

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

Repo provides access to a git repository.

func NewRepo

func NewRepo(remote, local string) (*Repo, error)

NewRepo creates a new git repository access object.

func (*Repo) Branches

func (repo *Repo) Branches() ([]string, error)

Branches returns a list of available branches.

func (*Repo) CheckLocal

func (repo *Repo) CheckLocal() bool

CheckLocal verifies the local location is a Git repo.

func (*Repo) Checkout

func (repo *Repo) Checkout(revisionBranchOrTag string) error

Checkout a revision, branch or tag.

func (*Repo) Clone

func (repo *Repo) Clone() error

Clone a repository.

func (*Repo) Current

func (repo *Repo) Current() (string, error)

Current returns the current branch/tag/revision. * Branch name if on the tip of the branch * Tag if on a tag * Otherwise a revision id

func (*Repo) Date

func (repo *Repo) Date() (time.Time, error)

Date retrieves the date on the latest commit.

func (*Repo) Fetch

func (repo *Repo) Fetch() error

Fetch a repository.

func (*Repo) HasChanges

func (repo *Repo) HasChanges() bool

HasChanges returns true if changes are present.

func (*Repo) HasDetachedHead

func (repo *Repo) HasDetachedHead() bool

HasDetachedHead returns true if the repo is currently in a "detached head" state.

func (*Repo) Init

func (repo *Repo) Init() error

Init initializes a git repository at the local location.

func (*Repo) Pull

func (repo *Repo) Pull() error

Pull a repository.

func (*Repo) Revision

func (repo *Repo) Revision() (string, error)

Revision retrieves the current revision.

func (*Repo) Tags

func (repo *Repo) Tags() ([]string, error)

Tags returns a list of available tags.

func (*Repo) TagsFromCommit

func (repo *Repo) TagsFromCommit(rev string) ([]string, error)

TagsFromCommit retrieves the tags from a revision.

Jump to

Keyboard shortcuts

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