Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CommitOptionsFromConfig ¶
CommitOptionsFromConfig creates and returns a *git.CommitOptions with the Author field populated based on the user's ~/.gitconfig.
Types ¶
type CommitOptions ¶
type CommitOptions = git.CommitOptions
type Repository ¶
type Repository struct { *git.Repository // contains filtered or unexported fields }
Repository is a struct that provides a simplified interface to a git repository.
func New ¶
func New(root string) (*Repository, error)
New creates and returns a new Repository rooted at the provided base path.
func (*Repository) Commit ¶
func (r *Repository) Commit(msg string, opts *git.CommitOptions) (string, error)
Commit creates a new commit in the git repository.
It returns the sha of the commit.
func (*Repository) CreateAndSwitchBranch ¶
func (r *Repository) CreateAndSwitchBranch(name string) error
CreateAndSwitchBranch switches from the current branch to the one with the name provided.
func (*Repository) WriteFile ¶
WriteFile writes data to the named file, creating it if necessary. If the file does not exist, WriteFile creates it with permissions perm (before umask); otherwise WriteFile truncates it before writing, without changing permissions.
The file is also "git added" to the current worktree.