Typorithm · medium

stash

git-stashgitstashwipshelve
Saved on this device
Full lesson · 8 learning steps Open any exercise for focused practice
1

Step 1 of 8 · intro card

Learn stash

0%

Advanced

git stash shelves uncommitted changes so you can switch context with a clean tree. push -m labels an entry, list shows the LIFO stash stack, pop reapplies and removes the top entry (apply keeps it), and drop deletes one.

git stash shelves your uncommitted changes — both staged and unstaged — and resets the working tree to a clean HEAD, so you can switch branches or pull without committing half-done work. push -m "wip" does the same but attaches a label.

The stashes form a LIFO stack. git stash list prints it, newest first, as stash@{0}, stash@{1}, and so on. Each entry remembers exactly the diff you shelved.

git stash pop reapplies the top entry and removes it from the stack; git stash apply reapplies but leaves it in place. git stash drop deletes an entry outright when you no longer need it.

01

stash shelves changes and cleans the tree.

02

push -m labels an entry; list shows the stack.

03

pop reapplies and removes; apply keeps; drop deletes.

git stash
git stash push -m "wip"
git stash list
git stash pop
git stash drop

Read the implementation

Connect each part of the code to the concept before you type.

1. Shelve changes

git stash saves uncommitted changes away and restores a clean working tree.

git stash

2. Labelled stash

push -m records a labelled stash entry so you can recognise it later in the list.

git stash push -m "wip"

3. List the stack

list shows the stash stack, with the most recent entry as stash@{0}.

git stash list

4. Reapply & remove

pop reapplies the top stash and deletes it; apply would reapply but keep it.

git stash pop

5. Delete an entry

drop deletes a stash entry without reapplying it.

git stash drop

A complete learning loop

01

Understand

Read the concept map and follow the code breakdown.

02

Reconstruct

Type the implementation, repair mistakes and work through every recall exercise.

03

Verify

Use the final check without hints; revisit weak concepts in short practice sessions.

stash: Lesson & Practice · Typorithm | ApplyDjinn