</>
Skip to content
Git lessons (21/44)

Git — Stash

Basic Stash

git stash

Stash with Message

git stash push -m "Work in progress"

View Stashes

git stash list

Apply Stash

# Apply without removing
git stash apply

# Apply and remove
git stash pop

Apply Specific Stash

git stash apply stash@{2}

Drop Stash

# Drop specific stash
git stash drop stash@{0}

# Drop all stashes
git stash clear

Stash Options

# Stash including untracked files
git stash -u

# Stash including ignored files
git stash -a

# Stash only specific files
git stash push -m "message" -- file1.txt file2.txt

View Stash Content

git stash show
git stash show -p

Mini Practice

  1. Stash changes
  2. View stashes
  3. Apply stashed changes
  4. Drop stashes

Up Next

Continue with Tags — tagging commits.

Related Topics

Frequently Asked Questions about Stash

What is Stash in Git?

Stash is a fundamental concept in Git. This lesson explains it step by step with clear examples, making it easy for beginners to understand.

How do I learn Stash?

Start by reading the explanation above, then try the code examples. Practice by modifying the examples and experimenting with different values. Hands-on practice is the best way to learn Stash.

Why is Stash important in Git?

Stash is essential for Git development. Understanding this concept will help you write better code and solve real-world problems more effectively.