git

package
v0.22.2 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2021 License: CC0-1.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CommentChar

func CommentChar() string

CommentChar returns active comment char and defaults to '#'

func CurrentBranch

func CurrentBranch() (string, error)

CurrentBranch returns the currently checked out branch

func Dir added in v0.22.1

func Dir() (string, error)

Dir returns the full path to the .git directory

func Edit

func Edit(filePrefix, message string) (string, string, error)

Edit opens a file in the users editor and returns the title and body.

func EditFile added in v0.22.1

func EditFile(filePrefix, message string) (string, error)

EditFile opens a file in the users editor and returns the contents. It stores a temporary file in your .git directory or /tmp if accessed outside of a git repo.

func Fetch added in v0.22.1

func Fetch(remote, commit string) error

Fetch a commit from a given remote

func GetLocalRemotes added in v0.22.1

func GetLocalRemotes() (string, error)

GetLocalRemotes returns a string of local remote names and URLs

func GetLocalRemotesFromFile added in v0.22.1

func GetLocalRemotesFromFile() (string, error)

GetLocalRemotesFromFile returns a string of local remote names and URLs based on their placement within .git/config file, which holds a different ordering compared to the alternatives presented by Remotes() and GetLocalRemotes().

func InsideGitRepo added in v0.9.1

func InsideGitRepo() bool

InsideGitRepo returns true when the current working directory is inside the working tree of a git repo

func IsRemote added in v0.6.0

func IsRemote(remote string) (bool, error)

IsRemote returns true when passed a valid remote in the git repo

func LastCommitMessage

func LastCommitMessage(sha string) (string, error)

LastCommitMessage returns the last commits message as one line

func Log

func Log(sha1, sha2 string) (string, error)

Log produces a formatted gitlog between 2 git shas

func New

func New(args ...string) *exec.Cmd

New looks up the git binary and returns a cmd which outputs to stdout

func NumberCommits added in v0.22.1

func NumberCommits(sha1, sha2 string) int

NumberCommits returns the number of commits between two commit refs

func PagerCommand added in v0.22.1

func PagerCommand() (string, []string)

PagerCommand returns the commandline and environment for the pager

func PathWithNamespace added in v0.22.1

func PathWithNamespace(remote string) (string, error)

PathWithNamespace returns the owner/repository for the current repo Such as zaquestion/lab Respects GitLab subgroups (https://docs.gitlab.com/ce/user/group/subgroups/)

func RemoteAdd

func RemoteAdd(name, url, dir string) error

RemoteAdd both adds a remote and fetches it

func RemoteBranches added in v0.22.1

func RemoteBranches(remote string) ([]string, error)

RemoteBranches get the list of branches the specified remote has

func Remotes added in v0.22.1

func Remotes() ([]string, error)

Remotes get the list of remotes available in the current repo dir

func RepoName

func RepoName() (string, error)

RepoName returns the name of the repository, such as "lab"

func Show added in v0.22.1

func Show(commit1, commit2 string, reverse bool)

Show all the commits between 2 git commits

func UpstreamBranch added in v0.22.1

func UpstreamBranch(branch string) (string, error)

UpstreamBranch returns the upstream of the specified branch

func WorkingDir

func WorkingDir() (string, error)

WorkingDir returns the full path to the root of the current git repository

Types

This section is empty.

Jump to

Keyboard shortcuts

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