git

package
v0.0.0-...-4551d9b Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2023 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 CurrentUpstreamBranch

func CurrentUpstreamBranch() (string, error)

CurrentUpstreamBranch returns the upstream of the currently checked out branch

func Dir

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

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

func Fetch(remote, commit string) error

Fetch a commit from a given remote

func GetLocalRemotes

func GetLocalRemotes() (string, error)

GetLocalRemotes returns a string of local remote names and URLs

func GetLocalRemotesFromFile

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 GetUnifiedDiff

func GetUnifiedDiff(BaseSHA string, HeadSHA string, oldPath string, newPath string) (string, error)

func InsideGitRepo

func InsideGitRepo() bool

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

func IsRemote

func IsRemote(remote string) (bool, error)

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

func LastCommitMessage

func LastCommitMessage() (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

func NumberCommits(sha1, sha2 string) int

func PagerCommand

func PagerCommand() (string, []string)

PagerCommand returns the commandline and environment for the pager

func PathWithNameSpace

func PathWithNameSpace(remote string) (string, error)

PathWithNameSpace returns the owner/repository for the current repo Such as prarit/rhstatus 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

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

func Remotes

func Remotes() ([]string, error)

func RepoName

func RepoName() (string, error)

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

func Show

func Show(commit1, commit2 string, reverse bool)

Show all the commits between 2 git commits

func UpstreamBranch

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