Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Git Essentials

You're reading from   Git Essentials Create, merge, and distribute code with Git, the most powerful and flexible versioning system available

Arrow left icon
Product type Paperback
Published in Apr 2015
Publisher
ISBN-13 9781785287909
Length 168 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Ferdinando Santacroce Ferdinando Santacroce
Author Profile Icon Ferdinando Santacroce
Ferdinando Santacroce
Arrow right icon
View More author details
Toc

Stashing

Working of different features in parallel does not make a developer happy, but sometimes it happens. So, at a certain point, we have to break the work on a branch and switch to another one. However, sometimes, we have some modifications that are not ready to be committed, because they are partial, inconsistent, or even won't compile. In this situation, Git prevents you from switching to another branch. You can only switch from one branch to another if you are in a clean state:

Stashing

To quickly resolve this situation, we can stash the modifications, putting them into a sort of box, ready to be unboxed at a later time.

Stashing is as simple as typing the git stash command. A default description will be added to your stash, and then modifications will be reverted to get back in a clean state:

Stashing

To list actual stashes, you can use the list subcommand:

Stashing

Once you have done the other work, you can go back to the previous branch and apply the stash to get back to the previous "work in progress...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime