Add daily email for 2024-10-24

git stash is underrated
This commit is contained in:
Oliver Davies 2024-10-25 23:24:50 +01:00
parent 67bcba326d
commit f784691c41

View file

@ -0,0 +1,21 @@
---
title: git stash is underrated
date: 2024-10-24
permalink: daily/2024/10/24/git-stash-is-underrated
tags:
- software-development
- git
cta: ~
snippet: |
`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.