back to TILs

Git Stash File(s)

This isn’t something I’m just learning today, but I’ve looked this up enough to warrant writing it down.

I’m often working on some code, and come across something unrelated that I want to change. So I do — but it really doesn’t belong in this commit or PR/patch/etc.!

(I’ve yet to put in the reps to understand worktrees or jujutsu, which I’m assuming are the “real” answers here.)

For now, you can provide git stash push a filename (or multiple!) to come back to those changes later:

$ git stash push <filename(s)>

I’m sure there’s also a way to do this incrementally with -p or Fugitive’s interface.

📦