git stash
Temporarily saves changes that are not ready to be committed.
The git stash
command allows you to temporarily save changes in your working directory that have not been committed yet. This is useful when you need to switch to a different branch or work on a different task without committing your current changes.
Stashing your changes creates a new stash entry and reverts the working directory to the state of the latest commit. When you are ready to revisit your changes, you can apply the stash back to your working directory using git stash apply
or git stash pop
.
Additionally, you can provide options to git stash
to handle untracked files (--include-untracked
) or try to stage changes (--keep-index
) before stashing.