git

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckForValidForkRemote

func CheckForValidForkRemote(upstreamURL, remoteURL, repo string) bool

CheckForValidForkRemote checks if the remote URL is a valid remote fork for the upstream URL.

Types

type Git

type Git struct {
	Dir     string
	Branch  string
	Remotes map[string]string
}

Git struct holds necessary data to work with the current git repository

func CloneAtDir

func CloneAtDir(url, dir string) (*Git, error)

CloneAtDir clones a repository at a given directory. Equivalent to: git clone <url> <dir> It will return a Git struct with the repository's branch and remotes populated.

func OpenGitRepo

func OpenGitRepo(workingDir string) (*Git, error)

OpenGitRepo TODO: Docs

func (*Git) AddAndCommit

func (g *Git) AddAndCommit(message string) error

AddAndCommit stages all changes and commits them with a given message, equivalent to: git add -A && git commit -m message

func (*Git) CheckFileExists added in v0.9.6

func (g *Git) CheckFileExists(file, branch string) error

CheckFileExists checks if a file exists in the git repository for a specific branch

func (*Git) CheckoutBranch

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

CheckoutBranch checks out a branch

func (*Git) CheckoutFile added in v0.9.6

func (g *Git) CheckoutFile(branch, file string) error

CheckoutFile checks out a file in a branch ex: git checkout <remote>/<branch> -- <file>

func (*Git) CreateAndCheckoutBranch

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

CreateAndCheckoutBranch creates and checks out to a given branch. Equivalent to: git checkout -b <branch>

func (*Git) DeleteBranch

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

DeleteBranch deletes the given branch

func (*Git) FetchAndCheckoutBranch

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

FetchAndCheckoutBranch fetches and checks out a branch

func (*Git) FetchBranch

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

FetchBranch fetches a branch

func (*Git) IsClean

func (g *Git) IsClean() error

IsClean checks if the git repository is clean and, returns nil if it is clean, throws an error otherwise

func (*Git) PushBranch

func (g *Git) PushBranch(remote, branch string) error

PushBranch pushes the current branch to a given remote name

func (*Git) ResetHEAD added in v0.9.6

func (g *Git) ResetHEAD() error

ResetHEAD resets the HEAD of the git repository ex: git reset HEAD

func (*Git) StatusProcelain

func (g *Git) StatusProcelain() (bool, error)

StatusProcelain checks if the git repository is clean and, returns true if it is clean, false otherwise

Jump to

Keyboard shortcuts

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