The git stash
command temporarily saves changes.
git stash # Save changes
git stash pop # Reapply changes
-
Use git stash to save uncommitted changes and switch branches.
-
Use git stash pop to reapply the saved changes.
git stash
git checkout main
git stash pop