920 B
920 B
title | date | permalink | tags | cta | snippet | ||
---|---|---|---|---|---|---|---|
git stash is underrated | 2024-10-24 | daily/2024/10/24/git-stash-is-underrated |
|
~ | `git stash` is underrated. |
git stash
is one of the commands I use the most.
Maybe because I do trunk-based development so I very rarely create new branches, or because I intentionally make and push small atomic commits, I often find myself using git stash
whilst debugging something or if I need to switch contexts quickly whilst in the middle of another task and I don't want to lose my changes.
If it's not something I'm going to unstash and bring back almost immediately, I can create a new branch or create a named stash with git stash save <name>
.
If I don't need to stash everything, it supports the -p
or --patch
option and I can decide what to stash and what to keep.
If you haven't used git stash
, I recommend giving it a try.