git

package
v0.0.0-...-4e1735e Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckoutBranch

func CheckoutBranch(wd, branch string) error

CheckoutBranch check out a branch, making it if it does not exist. git checkout -b <branch_name>

func Commit

func Commit(wd string, messages string) error

Commit Commits any current staged changes. git commit -m "${mergeBranchCommitMsg}" -m "automated update of ${PARAM_CHANGELOG_FILE}"

func Config

func Config(wd, key, val string) error

Config Set or return a config global value. git config <key> <value>

func ConfigGlobal

func ConfigGlobal(wd, key, val string) error

ConfigGlobal Set or return a config global value. git config --global <key> <value>

func DoesBranchExistRemotely

func DoesBranchExistRemotely(wd, uri, branch string) bool

DoesBranchExistRemotely return the result of: git ls-remote --heads <repository_url> <branch_name>

func GetCurrentTag

func GetCurrentTag(wd string) string

func HasSemverTag

func HasSemverTag(wd, commit string) bool

HasSemverTag Indicates when a commit is tagged.

Uses git describe to finds the most recent tag that is reachable from a
commit. Only shows annotated tags.

func IsCommit

func IsCommit(wd, commit string) bool

IsCommit Verify a hash is a commit.

func LastLog

func LastLog(wd string) string

LastLog Return the last commit log.

func Log

func Log(wd, refId string) string

Log Return a commit log.

func PrintStatus

func PrintStatus(wd string)

PrintStatus Outputs the git status of the specified directory.

func Push

func Push(wd, origin, branch string) error

Push Pushes changes to an origin. git push origin <branch_name>

func RemoteGetUrl

func RemoteGetUrl(wd, name string, flags ...string) (string, error)

RemoteGetUrl runs `git remote get-url --push origin <name>`

func RemoteOriginAdd

func RemoteOriginAdd(wd, name, uri string) error

RemoteOriginAdd runs `git remote add <origin> <uri>`

func RemoteOriginRemove

func RemoteOriginRemove(wd, name string) error

RemoteOriginRemove Will run the command: `git remote remove <origin>`

func RemoteSetUrl

func RemoteSetUrl(wd, name, newUrl, oldUrl string, flags ...string) error

RemoteSetUrl runs `git remote set-url [--push] <name> <newurl> [oldUrl]`

func RunCommandInteractive

func RunCommandInteractive(
	wd,
	program string,
	args []string,
) (io.ReadCloser, io.ReadCloser, io.WriteCloser, error)

RunCommandInteractive run an external program via CLI interactively, in a sub process; passing environment variables along.

It will pass in the os.Environ(), overwriting key=value pairs from env map,
comparison for the key (variable name) is case-sensitive.

func StageFiles

func StageFiles(wd string, files ...string) error

StageFiles git add CHANGELOG.md "${gitChgLogCon}gDir}"

func StatusWithOptions

func StatusWithOptions(wd string, options []string) ([]byte, error)

StatusWithOptions Print git status, pass in some optional flags if needed.

Types

This section is empty.

Jump to

Keyboard shortcuts

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