git

package
v1.0.7 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Commander

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

Commander handles git command execution

func NewCommander

func NewCommander(dryRun bool) *Commander

NewCommander creates a new git commander

func (*Commander) RunCommand

func (c *Commander) RunCommand(command, description string) error

RunCommand runs a git command, either for real or simulate in dry-run mode

func (*Commander) RunCommandWithOutput

func (c *Commander) RunCommandWithOutput(command, description string) (string, error)

RunCommandWithOutput runs a git command and returns its output

type Operations

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

Operations provides higher-level git operations

func NewOperations

func NewOperations(dryRun bool) *Operations

NewOperations creates a new git operations handler

func (*Operations) AddFile

func (o *Operations) AddFile(filePath string) error

AddFile stages a file for commit

func (*Operations) ApplyCheckout

func (o *Operations) ApplyCheckout() error

ApplyCheckout applies sparse-checkout changes by reading the tree

func (*Operations) Commit

func (o *Operations) Commit(message string) error

Commit creates a commit with the specified message

func (*Operations) CreateAndSwitchToBranch

func (o *Operations) CreateAndSwitchToBranch(branchName string) error

CreateAndSwitchToBranch creates a new branch and switches to it

func (*Operations) DisableSparseCheckout

func (o *Operations) DisableSparseCheckout() error

DisableSparseCheckout disables sparse-checkout using modern git command

func (*Operations) FetchAll

func (o *Operations) FetchAll() error

FetchAll fetches all remote branches and tags

func (*Operations) GetCommitHash

func (o *Operations) GetCommitHash() (string, error)

GetCommitHash returns the current commit hash

func (*Operations) GetCurrentBranch

func (o *Operations) GetCurrentBranch() (string, error)

GetCurrentBranch returns the name of the currently checked out branch

func (*Operations) GetLocalBranches

func (o *Operations) GetLocalBranches() (map[string]bool, error)

GetLocalBranches returns a map of local branch names

func (*Operations) GetRemoteBranches

func (o *Operations) GetRemoteBranches(defaultBranch string) (map[string]bool, error)

GetRemoteBranches gets list of remote branch names without creating local tracking branches

func (*Operations) GetShortCommitHash

func (o *Operations) GetShortCommitHash() (string, error)

GetShortCommitHash returns the short current commit hash

func (*Operations) InitSparseCheckout

func (o *Operations) InitSparseCheckout() error

InitSparseCheckout initializes sparse-checkout using modern init command

func (*Operations) InitSparseCheckoutCone

func (o *Operations) InitSparseCheckoutCone() error

EnableSparseCheckoutCone enables Git sparse-checkout with cone mode using modern init command

func (*Operations) IsRepository

func (o *Operations) IsRepository() (bool, error)

IsRepository checks if the current directory is a Git repository

func (*Operations) MergeBranchToMain

func (o *Operations) MergeBranchToMain(branchName string) error

MergeBranchToMain merges a specific branch into main

func (*Operations) PullMainFromRemote

func (o *Operations) PullMainFromRemote() error

PullMainFromRemote pulls the latest changes from remote main

func (*Operations) PushAllBranches

func (o *Operations) PushAllBranches() error

PushAllBranches pushes all local branches to remote

func (*Operations) PushBranch

func (o *Operations) PushBranch(branchName string) error

PushBranch pushes a specific branch to remote

func (*Operations) SetSparseCheckoutPaths

func (o *Operations) SetSparseCheckoutPaths(paths []string) error

SetSparseCheckoutPaths sets the sparse-checkout paths using git sparse-checkout command

func (*Operations) SwitchToBranch

func (o *Operations) SwitchToBranch(branchName string) error

SwitchToBranch switches to the specified branch

func (*Operations) UpdateBranchFromMain

func (o *Operations) UpdateBranchFromMain(branchName string) error

UpdateBranchFromMain updates a branch with the latest changes from main

Jump to

Keyboard shortcuts

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