git

package
v0.0.0-...-c4ec94d Latest Latest
Warning

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

Go to latest
Published: May 4, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckForGitUsername

func CheckForGitUsername() (string, error)

CheckForGitUsername checks for a git username set in the expected location

func CheckoutMasterAndPull

func CheckoutMasterAndPull() error

CheckoutMasterAndPull checks out the current branch to master and pulls down the latest

func CloneRepository

func CloneRepository(name string, sshURL string, path string) error

CloneRepository accepts an ssh url and clones a repository to a specified directory

func CurrentBranch

func CurrentBranch() (string, error)

CurrentBranch returns the name of the branch in the current working directory

func CurrentRepositoryName

func CurrentRepositoryName() (string, error)

CurrentRepositoryName returns the name of the repository of the current working directory from any of its subdirectories

func CurrentRepositoryOrganization

func CurrentRepositoryOrganization() (string, error)

CurrentRepositoryOrganization parses the local git config's remote.origin.url to determine the 'organization' or top-level 'user' of a repository

func ExtractOrganizationAndRepoNameFromRepoURL

func ExtractOrganizationAndRepoNameFromRepoURL(url string) (organization string, repo string)

ExtractOrganizationAndRepoNameFromRepoURL parses the organization/user and repository name from the repo URL - the usecase here is when results are returned from search and information about the repository/organization aren't available absent parsing this value and/or making an additional API call example RepositoryURL: "https://api.github.com/repos/counterThreat/chess_app",

func GetCurrentGitBaseURL

func GetCurrentGitBaseURL() string

GetCurrentGitBaseURL returns the current base git url

func HasUnpushedChangesOrCommits

func HasUnpushedChangesOrCommits() (bool, error)

HasUnpushedChangesOrCommits checks whether there are unpushed local commits

func IsEnterpriseGit

func IsEnterpriseGit() (bool, error)

IsEnterpriseGit is a helper for determining whether or not the active repository is from github.com or an enterprise instance

func NewClient

func NewClient(ctx context.Context, token string) *github.Client

NewClient initializes a new github client

func NewEnterpriseClient

func NewEnterpriseClient(ctx context.Context, hostname string, token string) (*github.Client, error)

NewEnterpriseClient creates a new github enterprise client

func PushBranchToOrigin

func PushBranchToOrigin(cb string) (err error)

PushBranchToOrigin pushes the current working directory's branch to origin

func RemoteRefExists

func RemoteRefExists(ref string) bool

RemoteRefExists returns a bool for whether a remote reference to a pull request exists

func RemoteRefOfCurrentBranchExists

func RemoteRefOfCurrentBranchExists() (bool, error)

RemoteRefOfCurrentBranchExists checks whether a remote ref of the current working directory's branch exists

Types

This section is empty.

Jump to

Keyboard shortcuts

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