What is Git Stash?

The git stash command allows you to save your uncommitted changes temporarily so you can work on something else, and come back to them later.

Stash Your Changes

git stash

This saves your modifications and reverts your working directory to match the HEAD commit.

List Stashes

git stash list

Displays a list of all stashed changes.

Apply Latest Stash

git stash apply

This re-applies the most recently stashed changes.

Apply a Specific Stash

git stash apply stash@{1}

This applies a specific stash entry.

Drop a Stash

git stash drop stash@{0}

Deletes a specific stash from the list.

Clear All Stashes

git stash clear

Deletes all stored stashes.