stash

package
v2.8.0 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package stash git-stash - Stash the changes in a dirty working directory away.

SYNOPSIS

Reference: https://git-scm.com/docs/git-stash

git stash list [<log-options>]
git stash show [-u | --include-untracked | --only-untracked] [<diff-options>] [<stash>]
git stash drop [-q | --quiet] [<stash>]
git stash pop [--index] [-q | --quiet] [<stash>]
git stash apply [--index] [-q | --quiet] [<stash>]
git stash branch <branchname> [<stash>]
git stash [push [-p | --patch] [-S | --staged] [-k | --[no-]keep-index] [-q | --quiet]
			 [-u | --include-untracked] [-a | --all] [(-m | --message) <message>]
			 [--pathspec-from-file=<file> [--pathspec-file-nul]]
			 [--] [<pathspec>…​]]
git stash save [-p | --patch] [-S | --staged] [-k | --[no-]keep-index] [-q | --quiet]
			 [-u | --include-untracked] [-a | --all] [<message>]
git stash clear
git stash create [<message>]
git stash store [(-m | --message) <message>] [-q | --quiet] <commit>

DESCRIPTION

Use `git stash` when you want to record the current state of the working directory and the index, but want to go back to a clean working directory. The command saves your local modifications away and reverts the working directory to match the `HEAD` commit.

The modifications stashed away by this command can be listed with `git stash list`, inspected with `git stash show`, and restored (potentially on top of a different commit) with `git stash apply`. Calling `git stash` without any arguments is equivalent to `git stash push`. A stash is by default listed as "WIP on branchname …", but you can give a more descriptive message on the command line when you create one.

The latest stash you created is stored in `refs/stash`; older stashes are found in the reflog of this reference and can be named using the usual reflog syntax (e.g. `stash@{0}` is the most recently created stash, `stash@{1}` is the one before it, `stash@{2.hours.ago}` is also possible). Stashes may also be referenced by specifying just the stash index (e.g. the integer `n` is equivalent to `stash@{n}`).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func All

func All(g *types.Cmd)

All This option is only valid for push and save commands. All ignored and untracked files are also stashed and then cleaned up with git clean. -a, --all

func Apply

func Apply(stash string, options ...types.Option) func(*types.Cmd)

Apply git stash apply [--index] [-q|--quiet] [<stash>]

func Branch

func Branch(branchName, stash string) func(*types.Cmd)

Branch git stash branch <branchname> [<stash>]

func Clear

func Clear() func(*types.Cmd)

Clear git stash clear

func Create

func Create() func(*types.Cmd)

Create git stash create

func Drop

func Drop(stash string, options ...types.Option) func(*types.Cmd)

Drop git stash drop [-q|--quiet] [<stash>]

func HyphenHyphen added in v2.8.0

func HyphenHyphen(g *types.Cmd)

HyphenHyphen add `--`

func IncludeUntracked

func IncludeUntracked(g *types.Cmd)

IncludeUntracked When used with the push and save commands, all untracked files are also stashed and then cleaned up with git clean. When used with the show command, show the untracked files in the stash entry as part of the diff. -u, --include-untracked

func Index

func Index(g *types.Cmd)

Index This option is only valid for pop and apply commands. Tries to reinstate not only the working tree’s changes, but also the index’s ones. However, this can fail, when you have conflicts (which are stored in the index, where you therefore can no longer apply the changes as they were originally). --index

func KeepIndex

func KeepIndex(g *types.Cmd)

KeepIndex This option is only valid for push and save commands. All changes already added to the index are left intact. -k, --keep-index

func List

func List(options ...types.Option) func(*types.Cmd)

List git stash list [<log-options>]

func NoIncludeUntracked

func NoIncludeUntracked(g *types.Cmd)

NoIncludeUntracked Opposite of --include-untracked. --no-include-untracked

func NoKeepIndex

func NoKeepIndex(g *types.Cmd)

NoKeepIndex Opposite of --keep-index. --no-keep-index

func OnlyUntracked

func OnlyUntracked(g *types.Cmd)

OnlyUntracked This option is only valid for the show command. Show only the untracked files in the stash entry as part of the diff. --only-untracked

func Patch

func Patch(g *types.Cmd)

Patch This option is only valid for push and save commands. Interactively select hunks from the diff between HEAD and the working tree to be stashed. The stash entry is constructed such that its index state is the same as the index state of your repository, and its worktree contains only the changes you selected interactively. The selected changes are then rolled back from your worktree. See the “Interactive Mode” section of git-add(1) to learn how to operate the --patch mode. The --patch option implies --keep-index. You can use --no-keep-index to override this. -p, --patch

func PathspecFileNul

func PathspecFileNul(g *types.Cmd)

PathspecFileNul This option is only valid for push command. Only meaningful with --pathspec-from-file. Pathspec elements are separated with NUL character and all other characters are taken literally (including newlines and quotes). --pathspec-file-nul

func PathspecFromFile

func PathspecFromFile(file string) func(*types.Cmd)

PathspecFromFile This option is only valid for push command. Pathspec is passed in <file> instead of commandline args. If <file> is exactly - then standard input is used. Pathspec elements are separated by LF or CR/LF. Pathspec elements can be quoted as explained for the configuration variable core.quotePath (see git-config(1)). See also --pathspec-file-nul and global --literal-pathspecs. --pathspec-from-file=<file>

func Pop

func Pop(stash string, options ...types.Option) func(*types.Cmd)

Pop git stash pop [--index] [-q|--quiet] [<stash>]

func Push

func Push(message string, options ...types.Option) func(*types.Cmd)

Push git stash push [-p|--patch] [-S|--staged] [-k|--[no-]keep-index] [-u|--include-untracked] [-a|--all] [-q|--quiet] [(-m|--message) <message>] [--pathspec-from-file=<file> [--pathspec-file-nul]] [--] [<pathspec>...]

func Quiet

func Quiet(g *types.Cmd)

Quiet This option is only valid for apply, drop, pop, push, save, store commands. Quiet, suppress feedback messages. -q, --quiet

func Save

func Save(message string, options ...types.Option) func(*types.Cmd)

Save git stash save [-p|--patch] [-S|--staged] [-k|--[no-]keep-index] [-u|--include-untracked] [-a|--all] [-q|--quiet] [<message>]

func Show

func Show(stash string, options ...types.Option) func(*types.Cmd)

Show git stash show [-u|--include-untracked|--only-untracked] [<diff-options>] [<stash>]

func Staged

func Staged(g *types.Cmd)

Staged This option is only valid for push and save commands. Stash only the changes that are currently staged. This is similar to basic git commit except the state is committed to the stash instead of current branch. The --patch option has priority over this one. -S, --staged

func Store

func Store() func(*types.Cmd)

Store git stash store

Types

This section is empty.

Jump to

Keyboard shortcuts

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