Skip to content

Git Stash

Git

Use git stash to temporarily save uncommitted changes.

Official Site
01

Overview

Stash saves working directory changes without committing. Use when switching branches with in-progress work. Pop restores changes. Stash stack: multiple stashes, apply by index. Stash includes untracked with -u.

bash
git stash push -m "wip: login form"
git checkout other-branch
# ... do work ...
git checkout original-branch
git stash pop  # restore changes
git stash list  # see all stashes
git stash drop stash@{0}  # remove
02

Best Practices

Stash with descriptive messages. Pop may conflict (resolve like merge). Use stash -u for untracked files. Stash -k to keep staged. Stash is per-branch but can be applied anywhere. Clean old stashes. Prefer WIP commit + amend over stash for longer breaks.))

Ready to try Git Stash?

Visit the official site for the latest version and full documentation.

Visit Git Stash