git

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2015 License: MIT Imports: 9 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package git contains various commands that shell out to git

Package git contains various commands that shell out to git

Index

Constants

View Source
const (
	RefTypeLocalBranch  = RefType(iota)
	RefTypeRemoteBranch = RefType(iota)
	RefTypeLocalTag     = RefType(iota)
	RefTypeRemoteTag    = RefType(iota)
	RefTypeHEAD         = RefType(iota) // current checkout
	RefTypeOther        = RefType(iota) // stash or unknown
)

Variables

View Source
var Config = &gitConfig{}

Functions

func CurrentBranch

func CurrentBranch() (string, error)

func CurrentRemote

func CurrentRemote() (string, error)

func FormatGitDate added in v0.6.0

func FormatGitDate(tm time.Time) string

FormatGitDate converts a Go date into a git command line format date

func LsRemote

func LsRemote(remote, remoteRef string) (string, error)

func ParseGitDate added in v0.6.0

func ParseGitDate(str string) (time.Time, error)

Parse a Git date formatted in ISO 8601 format (%ci/%ai)

func UpdateIndex added in v0.5.2

func UpdateIndex(file string) error

Types

type CommitSummary added in v0.6.0

type CommitSummary struct {
	Sha            string
	ShortSha       string
	Parents        []string
	CommitDate     time.Time
	AuthorDate     time.Time
	AuthorName     string
	AuthorEmail    string
	CommitterName  string
	CommitterEmail string
	Subject        string
}

Some top level information about a commit (only first line of message)

func GetCommitSummary added in v0.6.0

func GetCommitSummary(commit string) (*CommitSummary, error)

Get summary information about a commit

type Ref added in v0.6.0

type Ref struct {
	Name string
	Type RefType
	Sha  string
}

A git reference (branch, tag etc)

func CurrentRef

func CurrentRef() (*Ref, error)

func CurrentRemoteRef

func CurrentRemoteRef() (*Ref, error)

func RecentBranches added in v0.6.0

func RecentBranches(since time.Time, includeRemoteBranches bool, onlyRemote string) ([]*Ref, error)

RecentBranches returns branches with commit dates on or after the given date/time Return full Ref type for easier detection of duplicate SHAs etc since: refs with commits on or after this date will be included includeRemoteBranches: true to include refs on remote branches onlyRemote: set to non-blank to only include remote branches on a single remote

func ResolveRef added in v0.5.2

func ResolveRef(ref string) (*Ref, error)

type RefType added in v0.6.0

type RefType int

func ParseRefToTypeAndName added in v0.6.0

func ParseRefToTypeAndName(fullref string) (t RefType, name string)

Get the type & name of a git reference

Jump to

Keyboard shortcuts

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