Hacker News new | ask | show | jobs
by Estragon 3725 days ago

  man git stash
2 comments

I can't trust git stash anymore. I mistyped something and it blew away a lot lot lot of work. So now I just commit stuff. If I want to get rid of the commit, I can follow it up with a reset.
I use commit amends (`git commit -a`) for continually updating these pseudo-stash commits.
If you can't trust `git stash`, you can't trust git in general, because you can do all kinds of destructive things (which are usually recoverable).
Not true. From the git stash man page: "If you mistakenly drop or clear stashes, they cannot be recovered through the normal safety mechanisms."

Git stash is more dangerous than other git commands, and I've personally witnessed more people losing work with stash accidents than with commit accidents. There may be plumbing commands that can get you there like fsck but the fact of the matter is you are better off committing or branching, from a safety standpoint.

also very handy for working on multiple branches concurrently, git worktree --help