Live data from Hacker News

Git: how to use stash

softwarecave.org

41–43 of 43 posts

Re: Git: how to use stash

#42
post #36

Earlier quoted context omitted.

How is this really any better/different than just giving a message to a stash?

how many times have you stashed, and in what stages of development, and when you try to apply them later, will they be in order and will they work on the codebase as it has changed? also, do you even remember you stashed, and is there a log longer than 1 line? stash is a quick hack, and is useful as a quick hack, but commits just work better.

Still no different than branches you forget to go back to. If you want the exact same behavior, than instead of

    stash apply
use

    stash branch PickingBackUpStash 

That said, the majority of my uses of stash are "git stash; git pull; git stash apply" Or, alternatively, "git stash --keep-index; build; test; commit; git stash pop"

The whole point is I am not leaving the stash for long. If I have left a stash dormant for some time, I likely just drop it. Similar with branches.

Re: Git: how to use stash

#43
post #39
post #37

Earlier quoted context omitted.

git stash -u is much shorter :p This is default for me, now, since I've had untracked files straight up deleted because I didn't include them in my stash.

> I've had untracked files straight up deleted because I didn't include them in my stash. Do you recall the actual circumstances? That shouldn't happen in the normal course of things...

It was an awkward circumstance where I'm sure I majorly screwed up. The problem is that I can't remember...which is why it's my default....just in case. :)

All I know is there was some stash dropping and checking out involved and somehow I lost a couple day's worth of work...oops.

Post reply on HN