Higher-level stash management operations that compose the lower-level
Git.stash/1 command.
All functions accept an optional keyword list. Use :config to specify the
repository via a Git.Config struct; when omitted a default config is built
from the environment.
Summary
Functions
Applies the latest stash (or a specific stash by index) without removing it.
Clears all stash entries.
Drops a specific stash entry.
Lists all stash entries.
Pops the latest stash entry, applying it and removing it from the stash list.
Saves current changes to the stash with a message.
Functions
Applies the latest stash (or a specific stash by index) without removing it.
Uses raw git stash apply since the underlying command module does not
support the apply subcommand directly.
Options
:config- aGit.Configstruct:index- stash index to apply (e.g.,1forstash@{1})
Examples
{:ok, :done} = Git.Stashes.apply()
{:ok, :done} = Git.Stashes.apply(index: 2)
Clears all stash entries.
Uses raw git stash clear since the underlying command module does not
support the clear subcommand directly.
Options
:config- aGit.Configstruct
Examples
{:ok, :done} = Git.Stashes.clear()
Drops a specific stash entry.
Delegates to Git.stash(drop: true).
Options
:config- aGit.Configstruct:index- stash index to drop (e.g.,1forstash@{1})
Examples
{:ok, :done} = Git.Stashes.drop()
{:ok, :done} = Git.Stashes.drop(index: 1)
@spec list(keyword()) :: {:ok, [Git.StashEntry.t()]} | {:error, term()}
Lists all stash entries.
Delegates to Git.stash(list: true).
Options
:config- aGit.Configstruct
Examples
{:ok, entries} = Git.Stashes.list()
Pops the latest stash entry, applying it and removing it from the stash list.
Delegates to Git.stash(pop: true).
Options
:config- aGit.Configstruct
Examples
{:ok, :done} = Git.Stashes.pop()
Saves current changes to the stash with a message.
Delegates to Git.stash(save: true, message: message).
Options
:config- aGit.Configstruct
Examples
{:ok, :done} = Git.Stashes.save("work in progress")