git

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Git

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

Git describes a git instance

func New

func New(gitBinPath string, repoDir string) (*Git, error)

New initialize a new git instance

func (*Git) Add

func (g *Git) Add(files ...string) error

Add perform a git add

func (*Git) Checkout

func (g *Git) Checkout(branch string) error

Checkout checkout a specific branch

func (*Git) Commit

func (g *Git) Commit(message string, author string) error

Commit perform a git commit

func (*Git) CurrentBranch

func (g *Git) CurrentBranch() (*string, error)

CurrentBranch get the current branch

func (*Git) HasChanges

func (g *Git) HasChanges() bool

HasChanges does the repo have any unstaged or untracked files

func (*Git) InitIfNeeded

func (g *Git) InitIfNeeded() error

InitIfNeeded initialize a new repo if needed

func (*Git) Pull

func (g *Git) Pull() error

Pull perform a git pull

func (*Git) Push

func (g *Git) Push(remote, local string) error

Push perform a git push

func (*Git) Remove

func (g *Git) Remove(filePath ...string) error

Remove perform a git rm -f

func (*Git) Version

func (g *Git) Version() (*int, error)

Version the git binary version

Jump to

Keyboard shortcuts

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