Junior — Middle
Have you used the stash in the Git version control system?
sobes.tech AI
Answer from AI
Yes, the temporary storage of changes (stash) in Git is used for temporarily saving uncommitted changes to switch to another branch or perform other operations without losing current work.
Main commands:
git stash— saves current changes and clears the working directory.git stash list— shows the list of saved stashes.git stash apply— applies the last saved stash, leaving it in the list.git stash pop— applies the last stash and removes it from the list.git stash drop— deletes a specific stash.
Example of usage:
git stash # Save changes
# switch to another branch
git checkout feature-branch
# return and restore changes
git checkout main
git stash pop
This is convenient when you need to quickly switch between tasks without making a commit.