Lecture # 15 - Git Stash
Git Stash:
git stash
is a command in Git that allows you to temporarily shelve changes you've made to your working directory, so you can work on something else without committing your changes to a branch.
Below are the steps to see how git stash works:
Check git status.
-
We don't want to commit changes. Use
git stash
now. The changes are saved now. -
Check the git status again to see the changes are saved or not.
-
To remove a stash use
git stash pop
.
Stash Commands:
List the Stashes:
To list the stashes
git stash list
is used.Drop Stashes:
If you no longer need a particular stash, you can remove it from the stash stack using
git stash drop [stash]
.Clear Stash Stack:
To clear the stash stack,
git stash clear
is used.
Subscribe to my newsletter
Read articles from Abdullah Bin Altaf directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by