Git Stash Basics Quiz

Reviewed by Editorial Team
The ProProfs editorial team is comprised of experienced subject matter experts. They've collectively created over 10,000 quizzes and lessons, serving over 100 million users. Our team includes in-house content moderators and subject matter experts, as well as a global network of rigorously trained contributors. All adhere to our comprehensive editorial guidelines, ensuring the delivery of high-quality content.
Learn about Our Editorial Process
| By ProProfs AI
P
ProProfs AI
Community Contributor
Quizzes Created: 81 | Total Attempts: 817
| Questions: 15 | Updated: Apr 30, 2026
Please wait...
Question 1 / 16
🏆 Rank #--
0 %
0/100
Score 0/100

1. What is the primary purpose of the git stash command?

Explanation

The git stash command is used to temporarily store uncommitted changes in your working directory, allowing you to revert to a clean state without losing your progress. This is particularly useful when you need to switch branches or pull updates without committing incomplete work.

Submit
Please wait...
About This Quiz
Git Stash Basics Quiz - Quiz

This Git Stash Basics Quiz tests your understanding of Git's stashing feature, a key tool for saving work-in-progress changes without committing. Learn how to use git stash to switch branches safely, recover lost changes, and manage multiple stashes effectively. Perfect for Grade 11 students mastering Git workflow and version control... see morebest practices. see less

2.

What first name or nickname would you like us to use?

You may optionally provide this to label your report, leaderboard, or certificate.

2. Which command saves your current changes to the stash with a descriptive message?

Explanation

Both commands, `git stash save 'message'` and `git stash push -m 'message'`, effectively save changes to the stash with a descriptive message. While `git stash save` is the older syntax, `git stash push -m` is the newer, preferred method that explicitly allows for a message, making both options valid.

Submit

3. How do you view all stashed changes in your repository?

Explanation

To view all stashed changes in a Git repository, you use the command `git stash list`. This command displays a list of all stashes, including their identifiers and messages, allowing you to see what changes have been temporarily saved without applying them to your working directory.

Submit

4. What does 'git stash pop' do?

Explanation

'git stash pop' applies the changes saved in the most recent stash to the working directory and simultaneously removes that stash entry from the stash list. This command is useful for retrieving temporarily stored changes while keeping the stash list organized by eliminating the applied stash.

Submit

5. What is the difference between 'git stash pop' and 'git stash apply'?

Explanation

'git stash pop' and 'git stash apply' both restore stashed changes, but they differ in how they handle the stash afterward. 'pop' removes the stash entry after applying the changes, while 'apply' keeps the stash intact for potential future use. This distinction is crucial for managing your stashed changes effectively.

Submit

6. How do you apply a specific stash (not the most recent one)?

Explanation

You can apply a specific stash using either `git stash apply stash@{n}` or `git stash pop stash@{n}`. The former applies the changes without removing the stash, while the latter applies the changes and removes the stash from the list. Both commands effectively allow you to retrieve a specific stash.

Submit

7. What command deletes all stashes in your repository?

Explanation

The command `git stash clear` is used to remove all stashed changes in a Git repository. Unlike other options, it specifically targets the entire stash list, effectively clearing it without the need to specify individual stashes. This is useful for maintaining a clean working environment by eliminating unnecessary stashed changes.

Submit

8. Which command shows the actual changes in a specific stash?

Explanation

Both `git stash show stash@{0}` and `git stash show -p stash@{0}` display the changes in a specific stash. The first command provides a summary, while the second shows a detailed patch of the changes. Therefore, both commands effectively reveal the modifications stored in the specified stash.

Submit

9. True or False: git stash only saves staged changes, not unstaged ones.

Explanation

Git stash saves both staged and unstaged changes. When you run `git stash`, it captures the current working directory state, including any modifications to tracked files, regardless of whether those changes have been staged or not. This allows you to temporarily set aside your work and revert to a clean working directory.

Submit

10. What flag do you use to stash untracked files as well?

Explanation

Using the -u or --include-untracked flag with the git stash command allows you to stash not only tracked changes but also untracked files. This is useful when you want to temporarily save your work, including new files that haven't been added to the staging area, without committing them.

Submit

11. How do you create a new branch from a stashed change?

Explanation

To create a new branch from a stashed change, you use the command `git stash branch branchname`. This command applies the stashed changes to a new branch named "branchname" and simultaneously removes the stash entry, allowing you to continue working on those changes in the new branch context.

Submit

12. True or False: Stashed changes are backed up automatically to a remote repository.

Explanation

Stashed changes are temporary and stored locally in your Git repository. They are not automatically pushed to a remote repository, meaning they won't be backed up unless explicitly applied and committed. This ensures that stashed changes remain private and are not shared until the user decides to do so.

Submit

13. What happens if you stash changes and then delete the branch you were on?

Submit

14. Which command removes a specific stash without applying it?

Submit

15. True or False: You can stash changes while in the middle of a merge or rebase.

Submit
×
Saved
Thank you for your feedback!
View My Results
Cancel
  • All
    All (15)
  • Unanswered
    Unanswered ()
  • Answered
    Answered ()
What is the primary purpose of the git stash command?
Which command saves your current changes to the stash with a...
How do you view all stashed changes in your repository?
What does 'git stash pop' do?
What is the difference between 'git stash pop' and 'git stash apply'?
How do you apply a specific stash (not the most recent one)?
What command deletes all stashes in your repository?
Which command shows the actual changes in a specific stash?
True or False: git stash only saves staged changes, not unstaged ones.
What flag do you use to stash untracked files as well?
How do you create a new branch from a stashed change?
True or False: Stashed changes are backed up automatically to a remote...
What happens if you stash changes and then delete the branch you were...
Which command removes a specific stash without applying it?
True or False: You can stash changes while in the middle of a merge or...
play-Mute sad happy unanswered_answer up-hover down-hover success oval cancel Check box square blue
Alert!