Documentation ¶
Overview ¶
Package git provides functionality for interacting with local and remote git repositories.
Index ¶
- Variables
- func AddRemote(gitRepo, remote, remoteLocation string) error
- func Checkout(gitRepo, branch string) error
- func Clone(remote, dir string, opts ...cloneOpt) error
- func CommitAll(gitRepo, commitMsg string) (string, error)
- func CommitEmpty(gitRepo, commitMsg string) (string, error)
- func CreateBranch(gitRepo, branch string) error
- func CreateTrackingBranch(gitRepo, branch string, remoteRef RemoteRef) error
- func DeleteBranch(gitRepo, branch string, force bool) error
- func Fetch(gitRepo, remote, refspec string, opts ...fetchOpt) error
- func GetCurrentBranch(cwd string) string
- func GetGitRepoRevision(cwd, branch string) (string, error)
- func GetRemotes(gitRepo string) ([]string, error)
- func Init(gitRepo string, bare bool) error
- func IsReachable(cwd, toRef, fromRef string) (bool, error)
- func IsSHA(ref string) bool
- func MatchBranchName(gitRepo string, pattern *regexp.Regexp) ([]string, error)
- func MatchBranchNameWithNamespace(gitRepo string, pattern, namespace *regexp.Regexp) ([]string, error)
- func NormalizeRef(ref string) string
- func PushRef(gitRepo, localRef string, pushTo RemoteRef, opts ...pushRefOpt) error
- func Refs(gitRepo string) (map[string]string, error)
- func RemoteBranches(gitRepo, remote string) ([]string, error)
- func RemoteHasBranch(gitRepo, remote, branch string) (bool, error)
- func ResolveRemoteSymbolicRef(gitRepo, remote string, ref string) (string, error)
- func RunGitIgnoreOutput(gitRepo string, cmd []string) error
- func StripRefs(ref string) string
- func StripRefsHead(ref string) string
- type BranchOpt
- type CommandOutput
- type DepthOpt
- type DryRunOpt
- type ForceOpt
- type NoTagsOpt
- type RemoteRef
- type SingleBranchOpt
Constants ¶
This section is empty.
Variables ¶
var ( // CommandRunnerImpl exists for testing purposes. CommandRunnerImpl cmd.CommandRunner = cmd.RealCommandRunner{} )
Functions ¶
func CommitEmpty ¶
CommitEmpty makes an empty commit (assuming nothing is staged). Returns the sha1 of the commit.
func CreateTrackingBranch ¶
CreateTrackingBranch creates a tracking branch.
func DeleteBranch ¶
DeleteBranch checks out to master and then deletes the current branch.
func GetCurrentBranch ¶
GetCurrentBranch returns current branch of a repo, and an empty string if repo is on detached HEAD.
func GetGitRepoRevision ¶
GetGitRepoRevision finds and returns the revision of a branch.
func GetRemotes ¶
GetRemotes returns the remotes for a repository.
func IsReachable ¶
IsReachable determines whether one commit ref is reachable from another.
func MatchBranchName ¶
MatchBranchName returns the names of branches who match the specified regular expression.
func MatchBranchNameWithNamespace ¶
func MatchBranchNameWithNamespace(gitRepo string, pattern, namespace *regexp.Regexp) ([]string, error)
MatchBranchNameWithNamespace returns the names of branches who match the specified pattern and start with the specified namespace.
func NormalizeRef ¶
NormalizeRef converts git branch refs into fully qualified form.
func RemoteBranches ¶
RemoteBranches returns a list of branches on the specified remote.
func RemoteHasBranch ¶
RemoteHasBranch checks whether or not a branch exists on a remote.
func ResolveRemoteSymbolicRef ¶
ResolveRemoteSymbolicRef resolves the target of a symbolic ref.
func RunGitIgnoreOutput ¶
RunGitIgnoreOutput runs the specified git command in the specified repo a and returns only an error, not the command output.
func StripRefsHead ¶
StripRefsHead removes leading 'refs/heads/' from a ref name.
Types ¶
type CommandOutput ¶
CommandOutput contains stdout/stderr for a command.
type DryRunOpt ¶
type DryRunOpt struct {
// contains filtered or unexported fields
}
type ForceOpt ¶
type ForceOpt struct {
// contains filtered or unexported fields
}
type NoTagsOpt ¶
type NoTagsOpt struct {
// contains filtered or unexported fields
}
type SingleBranchOpt ¶
type SingleBranchOpt struct {
// contains filtered or unexported fields
}
func SingleBranchIf ¶
func SingleBranchIf(enabled bool) *SingleBranchOpt
SingleBranch clones only a single branch
Directories ¶
Path | Synopsis |
---|---|
Generates options.go, which implements git options.
|
Generates options.go, which implements git options. |