How do you view all stashes in a Git repository?

How do you view all stashes in a Git repository?

a) git stash list
b) git log --stash
c) git stash show
d) git reflog stash

Answer:

a) git stash list

Explanation:

The git stash list command shows all the stashes saved in the repository. Each stash is listed with a unique identifier, making it easier to reference and apply later.

For example, running git stash list will output a list of all saved stashes, including the latest one and any previously created stashes.

This command is useful for managing multiple stashes and reapplying or dropping them as needed.

Reference:

Top 100 Git and GitHub MCQ Questions and Answers

Scroll to Top