Greg Hewgill (ghewgill) wrote,
Greg Hewgill
ghewgill

git ate my stash

While working away on some code at work, I noticed that my git stash was suddenly unexpectedly empty! This was surprising because I had a few things I was working on stored in there for future attention. After a brief minor panic, I remembered that we make daily full backups of the gigabytes of stuff in our home directories, so the short story is I was able to recover my works in progress.

I noticed a day or two ago that git had run a git-gc pass on my repository, perhaps just because it felt like it needed doing. I suspect this is the point at which my stashes disappeared. While I haven't found anything that really explicitly says so, it seems that git by default auto-expires stashed changes after 30 days. I'll have to check the dates on the commits when I'm at work tomorrow, but that seems like it was very likely the reason for the disappearance.

Also, the as-yet-unreleased git 1.6.0 release notes states:

* By default, stash entries never expire.  Set reflogexpire in [gc
  "refs/stash"] to a reasonable value to get traditional auto-expiration
  behaviour back

So, since I'm using 1.5.6.4, it sounds like the 30 day expire was indeed completely expected, even though I don't recall reading much about that. In any case, the git-stash man page fails to mention anything about expiration at all. I'd submit a patch to fix it, but with the change to the default expiration of stash entries, that won't be necessary.

With all I've learned about git in the past 30 days though, I will henceforth create branches for works in progress that I need to leave alone for a while. The stash always felt like a bit of a tenuous container for stuff I want to keep. Now I'll just use it for truly temporary storage.

Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 1 comment