Skip to Main Content
Pragmatic Guide to Git
book

Pragmatic Guide to Git

by Travis Swicegood
November 2010
Beginner content levelBeginner
160 pages
2h 50m
English
Pragmatic Bookshelf
Content preview from Pragmatic Guide to Git
26 Temporarily Hiding Changes

Some Git operations, such as git rebase, require a clean working tree—a working tree with no changes. git stash gives you a tool to hide changes that aren’t quite ready to commit so you can come back to them.

Stashing changes is the equivalent of creating a commit and then resetting your repository back one commit. Stash provides a mechanism for grabbing those changes out of history more easily, however.

Stash names are similar to the names you see in the reflog (see Task 40, Retrieving “Lost” Commits). You refer to them as stash@{#}, replacing the # with the age of the stash. The most recent is 0, the one before that is 1, and so on.

You can call git stash without any parameters to create a new stash. ...

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

Pragmatic Version Control Using Git

Pragmatic Version Control Using Git

Travis Swicegood
Git Version Control Cookbook - Second Edition

Git Version Control Cookbook - Second Edition

Kenneth Geisshirt, Emanuele Zattin(EUR), Aske Olsson, Rasmus Voss
Git for Programmers

Git for Programmers

Jesse Liberty

Publisher Resources

ISBN: 9781680500028Errata