git

package
v0.1.0-rc.0 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2026 License: BlueOak-1.0.0 Imports: 9 Imported by: 0 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

internal/git/git.go

Index

Constants

This section is empty.

Variables

View Source
var ErrDirtyWorkTree = errors.New("working tree has uncommitted changes")

ErrDirtyWorkTree is returned when the working tree has uncommitted changes.

Functions

This section is empty.

Types

type Git

type Git struct {
	// contains filtered or unexported fields
}

Git provides git operations for a repository.

func New

func New(repoPath string) *Git

New creates a Git instance for the repository at the given path.

func (*Git) BranchExists

func (g *Git) BranchExists(branch string) bool

BranchExists checks if a branch exists.

func (*Git) Checkout

func (g *Git) Checkout(branch string) error

Checkout switches to the specified branch.

func (*Git) Commit

func (g *Git) Commit(message string) error

Commit creates a commit with the given message.

func (*Git) CreateAndCheckout

func (g *Git) CreateAndCheckout(name string) error

CreateAndCheckout creates a new branch and switches to it.

func (*Git) CreateBranch

func (g *Git) CreateBranch(name string) error

CreateBranch creates a new branch at the current HEAD.

func (*Git) CurrentBranch

func (g *Git) CurrentBranch() (string, error)

CurrentBranch returns the name of the current branch.

func (*Git) DeleteBranch

func (g *Git) DeleteBranch(branch string) error

DeleteBranch deletes a local branch.

func (*Git) FastForward

func (g *Git) FastForward(branch string) error

FastForward fast-forwards a branch to its remote tracking branch.

func (*Git) Fetch

func (g *Git) Fetch() error

Fetch fetches from origin.

func (*Git) GetGitDir

func (g *Git) GetGitDir() string

GetGitDir returns the .git directory path.

func (*Git) GetMergeBase

func (g *Git) GetMergeBase(a, b string) (string, error)

GetMergeBase returns the merge base of two branches.

func (*Git) GetTip

func (g *Git) GetTip(branch string) (string, error)

GetTip returns the commit SHA at the tip of a branch.

func (*Git) HasStagedChanges

func (g *Git) HasStagedChanges() (bool, error)

HasStagedChanges returns true if there are staged changes.

func (*Git) IsDirty

func (g *Git) IsDirty() (bool, error)

IsDirty returns true if there are uncommitted changes (staged or unstaged).

func (*Git) IsRebaseInProgress

func (g *Git) IsRebaseInProgress() bool

IsRebaseInProgress checks if a rebase is in progress.

func (*Git) NeedsRebase

func (g *Git) NeedsRebase(branch, parent string) (bool, error)

NeedsRebase returns true if branch needs to be rebased onto parent.

func (*Git) Push

func (g *Git) Push(branch string, force bool) error

Push force-pushes a branch to origin with lease.

func (*Git) Rebase

func (g *Git) Rebase(onto string) error

Rebase rebases the current branch onto target.

func (*Git) RebaseAbort

func (g *Git) RebaseAbort() error

RebaseAbort aborts an in-progress rebase.

func (*Git) RebaseContinue

func (g *Git) RebaseContinue() error

RebaseContinue continues an in-progress rebase.

Jump to

Keyboard shortcuts

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