What is Git Stashing?


Stashing allows us to save changes on files locally for future use.

For example, you are working on a branch for new feature and suddenly you need to do some bug fixes urgently. Then what you will do, you will stash the new feature file for future use by using below command:

git stash save <message>

Then you can clean the branch and work on bug fixes. after commit of bug fixes, you can pull the written code of new features from stash. To see the list, you can use below code:

git stash list

Then you can use the below code to use the code from stash to your current branch.

git stash pop <stash id>
ex: git stash pop 1

if you use only git stash pop then it will pop the recent stash one.

If you want to drop the stash, then you can use:

git stash drop <stash id>


git stash drop


How useful was this post?

Click on a star to rate it!

Leave a Reply

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