Documentation ¶
Overview ¶
Package git provide a wrapper for git command line interface.
Index ¶
- func CheckoutRevision(repoDir, remoteName, branch, revision string) error
- func Clone(remoteURL, dest string) (err error)
- func FetchAll(repoDir string) (err error)
- func FetchTags(repoDir string) (err error)
- func GetRemoteURL(repoDir, remoteName string) (url string, err error)
- func GetTag(repoDir, revision string) (tag string, err error)
- func LatestCommit(repoDir, ref string) (commit string, err error)
- func LatestTag(repoDir string) (tag string, err error)
- func LatestVersion(repoDir string) (version string, err error)
- func ListTags(repoDir string) (tags []string, err error)
- func LogRevisions(repoDir, prevRevision, nextRevision string) (err error)
- func RemoteBranches(repoDir string) ([]string, error)
- func RemoteChange(repoDir, oldName, newName, newURL string) (err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckoutRevision ¶
CheckoutRevision will set the HEAD to specific revision on specific branch. Any untracked files and directories will be removed before checking out existing branch or creating new branch. If remoteName is empty, it will use default reference "origin". If branch is empty, it will use default branch "master". If revision is empty, it will do nothing.
This function assume that repository is up-to-date with remote. Client may call FetchAll() before, to prevent checking out revision that may not exist.
func Clone ¶
Clone the repository into destination directory.
If destination directory is not empty it will return an error.
func GetRemoteURL ¶
GetRemoteURL return remote URL or error if repository is not git or url is empty. If remoteName is empty, it will be set to default ("origin").
func LatestCommit ¶
LatestCommit get the latest commit hash in short format from "ref". If ref is empty, its default to "origin/master".
func LatestVersion ¶
LatestVersion will try to get latest tag from repository. If it's fail get the latest commit hash.
func LogRevisions ¶
LogRevisions get commits between two revisions.
func RemoteBranches ¶
RemoteBranches return list of remote branches.
func RemoteChange ¶
RemoteChange change current repository remote name (e.g. "origin") to new remote name and URL.
Types ¶
This section is empty.