Documentation
¶
Overview ¶
Package git provides git-focused subcommands for branch, status, commit, push, diff, stash, and update operations across repository batches.
Commands in this package build call.Func handlers that execute git CLI commands within each selected repository while preserving shared output semantics.
Index ¶
- Constants
- Variables
- func Branch(ctx context.Context, ch output.Channel) error
- func Clean(ctx context.Context, ch output.Channel) error
- func Cmd() *cobra.Command
- func Commit(ctx context.Context, ch output.Channel) error
- func Push(ctx context.Context, ch output.Channel) error
- func StashPop(ctx context.Context, ch output.Channel) error
- func StashPush(ctx context.Context, ch output.Channel) error
- func Status(ctx context.Context, ch output.Channel) error
- func Update(ctx context.Context, ch output.Channel) error
- func ValidateBranch(branch ...string) call.Func
- func ValidateStash(ctx context.Context, ch output.Channel) error
Constants ¶
const ( // StageNone commits only what is already in the index. StageNone = "none" // StageTracked stages modifications and deletions to tracked files, like `git commit -a`. StageTracked = "tracked" // StageAll stages everything including untracked files, like `git add -A`. StageAll = "all" )
Staging modes for the commit command, mirroring the three behaviors git itself provides.
const ( // StashTracked stashes only tracked files. StashTracked = "tracked" // StashUntracked also stashes untracked files, like `git stash push -u`. StashUntracked = "untracked" // StashAll additionally stashes ignored files, like `git stash push -a`. StashAll = "all" )
Stash scopes controlling which files `git stash push` captures.
const ( // PullDefault defers to the repository's own pull configuration. PullDefault = "default" // PullFFOnly refuses to pull when a merge commit would be required. PullFFOnly = "ff-only" // PullRebase rebases local commits onto the upstream branch. PullRebase = "rebase" // PullMerge always creates a merge commit when histories diverge. PullMerge = "merge" )
Pull strategies for the update command.
Variables ¶
var AvailablePullStrategies = []string{PullDefault, PullFFOnly, PullRebase, PullMerge}
AvailablePullStrategies lists the valid values for the --pull-strategy flag.
var AvailableStageModes = []string{StageNone, StageTracked, StageAll}
AvailableStageModes lists the valid values for the --stage flag.
var AvailableStashScopes = []string{StashTracked, StashUntracked, StashAll}
AvailableStashScopes lists the valid values for the --scope flag.
Functions ¶
func Branch ¶ added in v0.9.6
Branch checks out a new branch in the given repository. Existing branches are reset unless git.branch.reset is disabled, in which case the checkout fails instead.
func Clean ¶ added in v0.11.0
Clean resets any uncommitted changes, removes untracked files, and re-initializes submodules. Removal of ignored files and submodule handling are both configurable.
func Commit ¶ added in v0.9.6
Commit stages changes according to the configured staging mode, creates a commit, and optionally pushes it to the remote repository.
func StashPop ¶ added in v0.11.0
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
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 ValidateBranch ¶ added in v0.10.0
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.
Types ¶
This section is empty.