Skip to Content
Linux in a Nutshell, 6th Edition
book

Linux in a Nutshell, 6th Edition

by Ellen Siever, Stephen Figgins, Robert Love, Arnold Robbins
September 2009
Beginner
942 pages
85h 34m
English
O'Reilly Media, Inc.
Content preview from Linux in a Nutshell, 6th Edition

Name

stash

Synopsis

git stash
git stash list
git stash show [stashid]
git stash apply [stashid]

Save, list, or reapply the set of uncommitted changes from a work tree and index.

This command takes one of four forms:

git stash

Save the current set of uncommitted changes and undo them. The index and work tree are reset to match HEAD.

git stash list

Show the list of all stashes that have previously been saved.

git stash show [stashid]

Show the exact set of changes that are saved as stashid. If stashid is omitted, uses the most recently saved changes.

git stash apply [stashid]

Brings back the changes from the given stashid and applies them to the current index and work tree. If stashid is omitted, uses the most recently saved changes.

Examples

To save the current set of uncommitted changes, switch branches, and apply those changes to the new branch:

$ git stash
Saved working directory and index state "WIP on master: 44951b7... Say hello"
(To restore them type "git stash apply")
HEAD is now at 44951b7 Say hello

$ git checkout feature1
Switched to a new branch "feature1"

$ git stash apply
Removed test1.c
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Unix in a Nutshell, 4th Edition

Unix in a Nutshell, 4th Edition

Arnold Robbins
Linux Under the Hood

Linux Under the Hood

Sander van Vugt
Linux Kernel in a Nutshell

Linux Kernel in a Nutshell

Greg Kroah-Hartman

Publisher Resources

ISBN: 9780596806088Errata Page