git

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package git provides git operations commands for batch-tool.

Index

Constants

This section is empty.

Variables

View Source
var (
	// Update checks out the default branch and pulls the latest changes.
	Update = call.Wrap(
		call.Exec("sh", "-c", "git checkout ${GIT_DEFAULT_BRANCH}"),
		call.Exec("git", "pull"),
	)

	// Clean resets any uncommitted changes, removes untracked files, and re-initializes submodules.
	Clean = call.Wrap(
		call.Exec("git", "reset", "--hard"),
		call.Exec("git", "clean", "-fd"),
		call.Exec("git", "submodule", "deinit", "-f", "."),
		call.Exec("git", "submodule", "update", "--init", "--recursive"),
	)
)

Functions

func Branch added in v0.9.6

func Branch(ctx context.Context, ch output.Channel) error

Branch checks out a new branch in the given repository.

func Cmd

func Cmd() *cobra.Command

Cmd configures the root git command along with all subcommands and flags

func Commit added in v0.9.6

func Commit(ctx context.Context, ch output.Channel) error

Commit stages all changes, creates a commit, and pushes it to the remote repository.

func Push added in v0.9.6

func Push(ctx context.Context, ch output.Channel) error

Push committed changes to the remote repository.

func StashPop added in v0.11.0

func StashPop(ctx context.Context, ch output.Channel) error

StashPop restores the most recently stashed changes if it's a batch-tool stash. Checks viper context to determine if changes were stashed by StashPush. Returns an error if changes were expected to be stashed but cannot be popped.

func StashPush added in v0.11.0

func StashPush(ctx context.Context, ch output.Channel) error

StashPush saves uncommitted changes to the stash stack with a timestamped message. If the worktree is clean, it reports success without error. Saves whether changes were stashed for each repository to the viper context for later retrieval.

func Status added in v0.9.6

func Status(ctx context.Context, ch output.Channel) error

Status shows the git status for the given repository.

func ValidateBranch added in v0.10.0

func ValidateBranch(branch ...string) call.Func

ValidateBranch returns an error if the current git branch is the default branch. If a branch name is provided, it checks against that branch instead.

func ValidateStash added in v0.11.0

func ValidateStash(ctx context.Context, ch output.Channel) error

ValidateStash checks if there is a batch-tool stash to pop. It returns an error if no suitable stash is found.

Types

This section is empty.

Jump to

Keyboard shortcuts

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