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 ¶
- func All(g *types.Cmd)
- func Apply(stash string, options ...types.Option) func(*types.Cmd)
- func Branch(branchName, stash string) func(*types.Cmd)
- func Clear() func(*types.Cmd)
- func Create() func(*types.Cmd)
- func Drop(stash string, options ...types.Option) func(*types.Cmd)
- func HyphenHyphen(g *types.Cmd)
- func IncludeUntracked(g *types.Cmd)
- func Index(g *types.Cmd)
- func KeepIndex(g *types.Cmd)
- func List(options ...types.Option) func(*types.Cmd)
- func NoIncludeUntracked(g *types.Cmd)
- func NoKeepIndex(g *types.Cmd)
- func OnlyUntracked(g *types.Cmd)
- func Patch(g *types.Cmd)
- func PathspecFileNul(g *types.Cmd)
- func PathspecFromFile(file string) func(*types.Cmd)
- func Pop(stash string, options ...types.Option) func(*types.Cmd)
- func Push(message string, options ...types.Option) func(*types.Cmd)
- func Quiet(g *types.Cmd)
- func Save(message string, options ...types.Option) func(*types.Cmd)
- func Show(stash string, options ...types.Option) func(*types.Cmd)
- func Staged(g *types.Cmd)
- func Store() func(*types.Cmd)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func All ¶
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 IncludeUntracked ¶
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 ¶
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 ¶
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 NoIncludeUntracked ¶
NoIncludeUntracked Opposite of --include-untracked. --no-include-untracked
func NoKeepIndex ¶
NoKeepIndex Opposite of --keep-index. --no-keep-index
func OnlyUntracked ¶
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 ¶
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 ¶
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 ¶
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 Push ¶
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 ¶
Quiet This option is only valid for apply, drop, pop, push, save, store commands. Quiet, suppress feedback messages. -q, --quiet
func Save ¶
Save git stash save [-p|--patch] [-S|--staged] [-k|--[no-]keep-index] [-u|--include-untracked] [-a|--all] [-q|--quiet] [<message>]
func Show ¶
Show git stash show [-u|--include-untracked|--only-untracked] [<diff-options>] [<stash>]
Types ¶
This section is empty.