Beyond the basics of git stash
yulia 10219ee912421f0b · · 中文 · 日本語

Beyond the basics of git stash

Many people (my past self included) only use git stash and git stash pop. It does much more.

Often-overlooked commands

git stash push -m "wip: login refactor" # a note for future you
git stash list                          # see what's shelved
git stash show -p stash@{1}             # inspect the diff
git stash apply stash@{2}               # apply without dropping
git stash drop stash@{0}                # delete one entry
git stash branch fix/login stash@{1}    # branch straight from a stash

The last one is a life-saver: if you've changed other things since stashing, branch from the stash instead of fighting conflicts.