Introduction: Git Stash

Learn about "stashing", and how to stash away changes.

We'll cover the following

In the next few lessons, you will learn a concept that you may end up using a lot!

Often when you are working, you want to return to a pristine state but you don’t want to lose the work you have done so far. Traditionally, with other source control tools, you’ve copied files that have changed locally aside, then updated your repository, and then diffed and re-applied the changed files.

Stash away your changes

Git has a concept of the “stash” to store all local changes ready to re-apply at will. You can get very sophisticated with the stash. But 99% of the time, I use it like this:

	[do some work]
	[get interrupted]
	git stash
	[deal with interruption]
	git stash pop

Create a free account to view this lesson.

By signing up, you agree to Educative's Terms of Service and Privacy Policy