git

package
v0.0.0-...-004cd70 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2024 License: GPL-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Add

func Add(repoPath, path string, dryRun bool) error

Add adds a file to the git index.

func CheckoutDefaultBranch

func CheckoutDefaultBranch(repo *git.Repository, repoPath string) (plumbing.ReferenceName, error)

CheckoutDefaultBranch checks out the default branch of a repository.

func Clone

func Clone(dir, url string) error

Clone runs a git clone which accounts for different default branches.

func Commit

func Commit(repoPath, commitMessage string, dryRun bool) error

Commit runs a git commit

func CreateRemote

func CreateRemote(repo *git.Repository, name, url string, dryRun bool) error

CreateRemote creates a new git remote in a repository

func DiffUnstaged

func DiffUnstaged(path string) error

DiffUnstaged shows a `git diff`. Due to limitations in the underlying go-git library, this implementation requires the /usr/bin/git binary. It gracefully skips if it cannot find the command on the system.

func EnsureGitRepo

func EnsureGitRepo(repoPath string) error

EnsureGitRepo ensures a git repo .git folder exists

func GetCurrentBranch

func GetCurrentBranch(repository *git.Repository) (string, error)

GetCurrentBranch retrieves the current branch of a repository.

func GetDefaultBranch

func GetDefaultBranch(repo *git.Repository, repoPath string) (plumbing.ReferenceName, error)

GetDefaultBranch retrieves the default branch of a repository.

func GetExcludesFiles

func GetExcludesFiles() ([]gitignore.Pattern, error)

GetExcludesFiles reads the exlude files from a global gitignore

func GetRecipeHead

func GetRecipeHead(recipeName string) (*plumbing.Reference, error)

GetRecipeHead retrieves latest HEAD metadata.

func HasBranch

func HasBranch(repository *git.Repository, name string) bool

Check if a branch exists in a repo. Use this and not repository.Branch(), because the latter does not actually check for existing branches. See https://github.com/gogit/gogit/issues/518 for more.

func Init

func Init(repoPath string, commit bool) error

Init inits a new repo and commits all the stuff if you want

func IsClean

func IsClean(repoPath string) (bool, error)

IsClean checks if a repo has unstaged changes

func Push

func Push(repoDir string, remote string, tags bool, dryRun bool) error

Push pushes the latest changes & optionally tags to the default remote

Types

This section is empty.

Jump to

Keyboard shortcuts

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