TL;DR

Put this in the [alias] section of your ~/.gitconfig:

wip = !git add -A && git commit -m "WIP"

Now you can git wip instead of git stash. All changes to the working tree are recorded in a proper commit. When you’re ready to resume work, just do a git reset HEAD^.

Background

git stash is sometimes convenient, but the feature has some drawbacks.

  • It’s easy to forget that you have something stashed
  • Pushing multiple stashes on the stack doesn’t seem useful
  • Untracked files are not stashed away

Storing all changes as a WIP commit is a simple way to leverage the “normal” git workflow to build a more powerful stashing feature.

Credit

I learned this trick, and several others, here.