stash: Save and revert local changes, or apply stashed changes
Usage:
eg stash list [--details]
eg stash [save DESCRIPTION]
eg stash apply [DESCRIPTION]
eg stash show [OPTIONS] [DESCRIPTION]
eg stash (drop [DESCRIPTION] | clear)
Description:
This command can be used to remove any changes since the last commit,
stashing these changes away so they can be reapplied later. It can also
be used to apply any previously stashed away changes. This command can
be used multiple times to have multiple sets of changes stashed away.
Unknown files (files which you have never run 'eg stage' on) are
unaffected; they will not be stashed away or reverted.
When no arguments are specified to eg stash, the current changes are
saved away with a default description.
WARNING: Using the default description can be a bad idea if you will not
be reapplying the stash very soon. The default description provided for
you is based on the commit message of the most recent commit, which has
confused some users into believing that they have already incorporated
changes from a stash and throwing the stash away (something that can be
recovered from, but which involves some sleuthing and low-level commands
like git-fsck and git-cat-file).
Examples:
You have lots of changes that you're working on, then get an important
but simple bug report. You can stash away your current changes, fix the
important bug, and then reapply the stashed changes:
$ eg stash
fix, fix, fix, build, test, etc.
$ eg commit
$ eg stash apply
You can provide a description of the changes being stashed away, and
apply previous stashes by their description (or a unique substring of the
description).
make lots of changes
$ eg stash save incomplete refactoring work
work on something else that you think will be a quick fix
$ eg stash save longer fix than I thought
fix some important but one-liner bug
$ eg commit
$ eg stash list
$ eg stash apply incomplete refactoring work
finish off the refactoring
$ eg commit
$ eg stash apply fix than I
etc., etc.
You want to get some details about an existing stash created above:
$ eg stash show incomplete refactoring
$ eg stash show -p incomplete refactoring
Options:
list [--details]
Show the saved stash descriptions. If the --details flag is present,
provide more information about each stash.
save DESCRIPTION
Save current changes with the description DESCRIPTION. The
description cannot start with "-".
apply [DESCRIPTION]
Apply the stashed changes with the specified description. If no
description is specified, and more than one stash has been saved, an
error message will be shown. The description cannot start with "-".
show [OPTIONS] [DESCRIPTION]
Show the stashed changes with the specified description. If no
description is specified, and more than one stash has been saved, an
error message will be shown. The description cannot start with "-".
Note that the output shown is the output from diff --stat. If you
want the full patch, pass the -p option. Other options for
controlling diff output (such as --name-status or --dirstat, see
'git help diff') are also possible options.
drop [DESCRIPTION]
Delete the specified stash. The description cannot start with
"-".
clear
Delete all stashed changes.
Differences from git stash:
eg stash is only cosmetically different than git stash, and is fully
backwards compatible.
eg stash list, by default, only shows the saved description -- not
the reflog syntax or branch the change was made on.
eg stash apply and eg stash show also accept any string and will
apply or show the stash whose description contains that string.
Although stash and apply accept reflog syntax (like their git stash
counterparts), i.e. while
$ eg stash apply stash@{3}
will work, I think it will be easier for the user to run
$ eg stash apply rudely interrupted changes
See also
Run 'git help stash' for a comprehensive list of options available.
eg stash is designed to accept the same options as git stash, and
with the same meanings unless specified otherwise in the above
"Differences" section.