Git stash individual files. 🗄

November 29, 2019 - 1 minute read -
dev git

TIL, you can stash individual files in a working directory with git stash push, followed by the paths of the files you want to stash.

For example, git stash push supe.rb pup.py will only stash supe.rb and pup.py, which can then be retrieved using git stash pop or git stash apply.

In practice, when working on a feature, I can use git stash push app/ui to stash frontend changes, to separate frontend and backend commits.

Learn more about git stash.