Documentation
¶
Overview ¶
Package stash provides git stash management operations.
This package handles stash creation, listing, application, and cleanup for git repositories.
Features ¶
- Stash creation with messages
- Stash listing and inspection
- Stash application and popping
- Bulk stash operations
Usage ¶
manager := stash.NewManager(repoPath)
err := manager.Push("WIP: feature work")
stashes, err := manager.List()
err = manager.Pop()
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DropOptions ¶
type DropOptions struct {
// Index is the stash index to drop
Index int
}
DropOptions configures stash drop operation.
type ListOptions ¶
type ListOptions struct {
// Limit limits the number of stashes to return
Limit int
}
ListOptions configures stash list operation.
type Manager ¶
type Manager interface {
// Save creates a new stash entry.
Save(ctx context.Context, repo *repository.Repository, opts SaveOptions) error
// List returns all stash entries.
List(ctx context.Context, repo *repository.Repository, opts ListOptions) ([]*Stash, error)
// Pop applies and removes a stash entry.
Pop(ctx context.Context, repo *repository.Repository, opts PopOptions) error
// Apply applies a stash entry without removing it.
Apply(ctx context.Context, repo *repository.Repository, opts PopOptions) error
// Drop removes a stash entry.
Drop(ctx context.Context, repo *repository.Repository, opts DropOptions) error
// Clear removes all stash entries.
Clear(ctx context.Context, repo *repository.Repository) error
// Count returns the number of stash entries.
Count(ctx context.Context, repo *repository.Repository) (int, error)
}
Manager defines stash operations.
type PopOptions ¶
type PopOptions struct {
// Index is the stash index to pop (default: 0)
Index int
// Apply applies without removing from stash list
Apply bool
}
PopOptions configures stash pop/apply operation.
type SaveOptions ¶
type SaveOptions struct {
// Message is the stash message (optional)
Message string
// IncludeUntracked includes untracked files
IncludeUntracked bool
// KeepIndex keeps staged changes in the index
KeepIndex bool
// All includes ignored files
All bool
}
SaveOptions configures stash save operation.
type Stash ¶
type Stash struct {
// Index is the stash index (0 = most recent)
Index int
// Ref is the stash reference (e.g., "stash@{0}")
Ref string
// Message is the stash message
Message string
// Branch is the branch where the stash was created
Branch string
// SHA is the commit SHA of the stash
SHA string
// Date is when the stash was created
Date time.Time
}
Stash represents a single stash entry.
Click to show internal directories.
Click to hide internal directories.