Skip to content
The Git Crypt

/static/cripta/en/ossada/stash/

Menu

GIT-003 · Rescue

git stash

Shelves your half-done work and hands the bench back clean.

git stash gathers the uncommitted changes — working tree and index — onto a side stack and leaves the directory clean. pop brings everything back; list shows the shelf; push -m labels each volume so the rescue isn't guesswork.

The fine-grained variant is --keep-index: it stashes only what is not in the index. You staged half a commit with git add and want to run the tests against exactly that half — the rest of the bench goes down to the shelf and waits its turn.

$ git add parser.go
$ git stash push --keep-index -m "resto da bancada"
Saved working directory and index state On main: resto da bancada
$ go test ./...
ok  	stickybit/parser	0.31s
Only the staged half stayed; the rest waits on the shelf.