gitpractice.dev

brewly — Ch.7 · Keep the stash tidy

Exercise 2 of 6

Before you start

A stack of entries

You can stash many times. The newest entry is stash@{0}, the one before it stash@{1}.

A plain stash leaves untracked files behind. -u takes them too, and -m gives the entry a name you will recognise later.

apply brings an entry back but keeps it. drop deletes it.

git stash push -u -m "label"
stash everything, with a name
git stash list
show the entries
git stash show -p stash@{1}
see what an entry holds
git stash drop stash@{1}
delete an entry
git stash apply
bring back, keeping the entry
You can reopen this any time with “Lesson”.

Continue on a desktop

Typing git on a small screen is no fun. Open this page on a laptop or desktop to practise.

Back to the path