git stash
`git stash` temporarily saves your uncommitted changes so you can switch branches or pull updates without committing incomplete work. It's like a clipboard for work in progress.
Stashed changes are stored in a list, so you can stash multiple times and later reapply any of them with `git stash pop` or `git stash apply`.
git stash
git stash list
git stash popSaving and listing stashes
Run `git stash` to save current changes and clean the working directory. Run `git stash list` to see all saved stashes.
Restoring stashed changes
Run `git stash pop` to reapply the most recent stash and remove it from the list, or `git stash apply` to reapply it while keeping it in the list.
git stashSaved working directory and index state WIP on main: 9c2e1aa Fix crashSaves current uncommitted changes and restores a clean working directory.
git stash popOn branch main
Changes not staged for commit:
modified: app.jsReapplies the most recently stashed changes and removes them from the stash list.
Key points
- git stash temporarily saves uncommitted changes.
- It cleans your working directory so you can switch tasks.
- git stash pop reapplies and removes the latest stash.
- git stash list shows all saved stashes.
