git

package
v0.0.0-...-1dd5a45 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2022 License: Apache-2.0 Imports: 8 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Add

func Add(log *log.Logger, files ...string) error

Execute a `git add`

func Checkout

func Checkout(log *log.Logger, branch string) error

Execute a `git checkout <branch>`

func Clone

func Clone(log *log.Logger, repoUrl, folder string) error

Execute a `git clone <repo-url> <folder>`

func Commit

func Commit(log *log.Logger, message string) error

Execute a `git commit`

func Diff

func Diff(log *log.Logger, a, b string) (string, error)

Execute a `git status a b`

func Fetch

func Fetch(log *log.Logger, remote string) error

Execute a `git fetch <remote>`

func FetchTags

func FetchTags(log *log.Logger, remote string) error

Execute a `git fetch --tags <remote>`

func GetConfig

func GetConfig(log *log.Logger, key string) (string, error)

Gets the a config value

func GetLatestLocalCommit

func GetLatestLocalCommit(log *log.Logger, folder, branch string, short bool) (string, error)

Gets the latest commit hash from the given local git folder.

func GetLatestRemoteCommit

func GetLatestRemoteCommit(log *log.Logger, repoUrl, branch string) (string, error)

Gets the latest commit hash from the given remote git repo + optional branch.

func GetLatestRemoteTag

func GetLatestRemoteTag(log *log.Logger, repoUrl string) (string, error)

Gets the latest tags from the given remote git repo.

func GetLatestTag

func GetLatestTag(log *log.Logger, folder string) (string, error)

Gets the latest tag from the repo in given folder.

func GetLocalBranchName

func GetLocalBranchName(log *log.Logger) (string, error)

Gets the name of the current branch

func GetMergeBase

func GetMergeBase(log *log.Logger) (string, error)

git show-branch --merge-base

func GetRemoteOriginUrl

func GetRemoteOriginUrl(log *log.Logger) (string, error)

Gets the config value for "remote.origin.url"

func Pull

func Pull(log *log.Logger, remote string) error

Execute a `git pull`

func Push

func Push(log *log.Logger, remote string, tags bool) error

Execute a `git push`

func Status

func Status(log *log.Logger, porcelain bool) (string, error)

Execute a `git status`

func Tag

func Tag(log *log.Logger, tag string) error

Execute a `git tag <tag>`

Types

type TagList

type TagList []string

func GetRemoteTags

func GetRemoteTags(log *log.Logger, repoUrl string) (TagList, error)

Gets the tags from the given remote git repo.

func (TagList) Len

func (this TagList) Len() int

Gets the length of the list

func (TagList) Less

func (this TagList) Less(i, j int) bool

Is element at i less than element at j?

func (TagList) Swap

func (this TagList) Swap(i, j int)

Swap elements at position i and j

Jump to

Keyboard shortcuts

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