stash

package
v0.151.3 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2026 License: MIT Imports: 6 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package stash wraps `git stash` so the CLI can present a friendly list/apply/drop UX without scattering shell-out logic across cli/.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Apply

func Apply(ctx context.Context, runner git.Runner, ref string) error

Apply restores the stash to the working tree without removing it.

func Drop

func Drop(ctx context.Context, runner git.Runner, ref string) error

Drop discards a stash entry. There's no undo — git keeps it in the reflog briefly but `gk stash` exposes no recovery, so callers should confirm before invoking.

func Pop

func Pop(ctx context.Context, runner git.Runner, ref string) error

Pop applies the stash and drops it on success — the standard "tuck this aside, then put it back" cycle.

func Push

func Push(ctx context.Context, runner git.Runner, message string, includeUntracked bool) error

Push records the current working tree as a new stash. message is optional; includeUntracked covers files not yet tracked by git.

func Show

func Show(ctx context.Context, runner git.Runner, ref string) (string, error)

Show returns the diff that the stash would apply, ready for a scrollable preview.

Types

type Entry

type Entry struct {
	Ref     string    // "stash@{0}"
	Index   int       // 0-based index parsed from Ref
	Created time.Time // committer date of the stash commit
	Message string    // free-form, usually "WIP on <branch>: <subject>"
}

Entry is one row from `git stash list`.

func List

func List(ctx context.Context, runner git.Runner) ([]Entry, error)

List returns every stash currently held by the repo (newest first — git's natural order).

Jump to

Keyboard shortcuts

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