How to save changes temporarily using git stash
Today we’ll show you how to save changes temporarily using git stash. Sometimes you might need to save your work temporarily. So you can use the git stash command to do it.
How to save changes temporarily using git stash, how to use git stash, git stash file, git stash untracked files, git stash committed changes, git stash no local changes to save, git stash apply specific file, git stash – temporary saving changes, git stashes as a temporary storage.
Different way to save changes using git stash
- Check list of stashed changes
- Save changes
- Save changes including untracked files
- Save changes with description
- Re-apply saved changes
- Re-apply saved changes and remove it from stash list
1. Check list of stashed changes
You can check stashed changes anytime by running the following command in the terminal.
git stash list
2. Save changes
To save changes temporarily, you have to run the following command.
Above command will stash only modified files. It’ll not include untracked files.
3. Save changes including untracked files
To save changes including untracked files, run stash command along with
--include-untracked. Check the following command.
git stash --include-untracked
git stash -u
4. Save changes with description
It’s good practice to save changes with a small description. So that changes could be easy to identify. Use the command
git stash save "message" to stashes with description.
git stash save "your message will come here..."
5. Re-apply saved changes
To re-apply stashed changes, run the following command.
git stash apply
6. Re-apply saved changes and remove it from stash list
If you want to re-apply the stashed changes and also want to remove it from the stash list then you can use
git stash pop
That’s it for today.
Thank you for reading. Happy Coding.