Documentation
¶
Overview ¶
Package git provides git operations commands for batch-tool.
Index ¶
- Variables
- func Branch(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 ValidateBranch(branch ...string) call.Func
- func ValidateStash(ctx context.Context, ch output.Channel) error
Constants ¶
This section is empty.
Variables ¶
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 Commit ¶ added in v0.9.6
Commit stages all changes, creates a commit, and 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.