Intermediate · 3 min read
Stash like a pro
Put work aside in two seconds without making a fake commit.
Save with a name
-u includes new untracked files, -m gives it a name you'll recognise in a week.
Safe
$ git stash push -u -m "wip: header redesign"
List and restore
apply keeps the stash, pop removes it once applied. Prefer apply when unsure: you can drop it later.
Safe
$ git stash list$ git stash apply stash@{0}
Turn a stash into a branch
The stash conflicts with your current code? Create a branch from the commit where it was made and apply it there.
Safe
$ git stash branch wip/header stash@{0}