Help us shape the future of Go! Take the 2026 Go Developer Survey

modify

package
v0.30.1 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package modify implements the modify command, which amends (or adds) a commit on the current branch or a downstack ancestor and restacks its descendants.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Action

func Action(ctx context.Context, deps Deps, opts Options) (err error)

Action performs the modify operation

Types

type Deps

type Deps struct {
	Engine Engine
	actions.MutationDeps
	// RepoRoot locates the continuation state a restack conflict writes.
	RepoRoot string
	// Verify runs commit hooks; false passes --no-verify.
	Verify bool
}

Deps are the collaborators modify needs. Adapters build them from their own runtime state; the action never sees bootstrap types.

type Engine

type Engine interface {
	validation.GitOperationEngine
	actions.OwnershipEngine
	Trunk() engine.Branch
	Graph(ctx context.Context, strategy engine.SortStrategy) *engine.StackGraph
	ListWorktrees(ctx context.Context) (git.WorktreeList, error)
	CheckoutBranch(ctx context.Context, branch engine.Branch) error
	IsBranchEmpty(ctx context.Context, branchName string) (bool, error)
	StageChanges(ctx context.Context, opts git.StagingOptions) error
	Commit(ctx context.Context, opts git.CommitOptions) error
	InteractiveRebase(ctx context.Context, onto string) error
}

Engine lists exactly the engine methods modify calls: the branch validators, the ownership guard, and the checkout/stage/commit mutations.

type Options

type Options struct {
	// Staging options
	All    bool // Stage all changes before committing (-a)
	Update bool // Stage updates to tracked files only (-u)
	Patch  bool // Pick hunks to stage interactively (-p)

	// Commit options
	CreateCommit bool   // Create a new commit instead of amending (-c)
	Message      string // Commit message (-m)
	Edit         bool   // Open editor to edit commit message (-e)
	NoEdit       bool   // Don't edit commit message (computed from flags)
	ResetAuthor  bool   // Reset author to current user
	Verbose      int    // Show diff in commit message template (-v)

	// Interactive rebase
	InteractiveRebase bool // Start interactive rebase on branch commits

	// Into targets a downstack ancestor of the current branch instead of the
	// current branch itself. Empty means "modify the current branch".
	Into string
}

Options contains options for the modify command

Jump to

Keyboard shortcuts

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