git stash
The command that saves your uncommitted changes aside and returns the working tree to the last commit, so you can come back to them later.
In more detail
git stash saves both staged and unstaged changes to tracked files, git stash list shows what is saved, and git stash pop reapplies the newest entry and removes it from the list. Untracked files are left alone unless you add -u.
Examples
git stashgit stash popRelated terms
- working tree — The files of a Git repository as they currently exist on disk, which you edit before staging and committing.
- git restore — The command that throws away uncommitted changes to a file, or with --staged takes a file back out of the staging area.
Taught in
- Undoing: restore, reset, revert And stash — Advanced Git Internals & Distributed Workflows