Understanding and Using Git Stash

understanding and using git stash - Jigar Karangiya

Git is a powerful version control system that is widely used by developers for managing their codebase. One of the lesser-known features of Git is the stash command. This feature allows developers to save changes temporarily and switch to a different branch without losing their work. In this blog post, we will discuss what Git stash is and how to use it.

What is Git stash?

Git stash is a command that allows you to save changes that have not been committed yet. It helps you to switch branches or restore your working directory to a clean state without losing your changes. The changes are stored on a stack and can be reapplied later when needed.

How to use Git stash?

Using Git stash is quite simple. Here are the steps to stash your changes:

  1. Make changes to your code and stage them.
  2. Run the following command to stash your changes:

The changes will be stored on the stash stack, and your working directory will be restored to a clean state.

To reapply the stash, run the following command:

This will reapply the changes from the stash to your working directory.

Other Git stash commands:

  1. git stash list” – This command displays a list of all stashes on the stack.
  2. git stash drop” – This command removes a stash from the stack.


Git stash is a handy feature for developers who need to switch branches or restore their working directory to a clean state without losing their changes. It is a simple command to use and can save you a lot of time and effort. Make sure to use Git stash regularly and keep your codebase organized.

Leave a Reply

Your email address will not be published. Required fields are marked *