# Re: Multiple user questions

3 messages from 2008-06-06 to 2008-06-06. Participants: Dennis Schridde, Brandon Casey.
Thread: https://gitlist.dev/t/13837

## Dennis Schridde, 2008-06-06 20:47

Subject: Re: Multiple user questions
Message-ID: <200806062247.42074.devurandom@gmx.net>
URL: https://gitlist.dev/e/200806062247.42074.devurandom%40gmx.net

```
I just ran into a lost stash again and thus would like to get an answer to 
this question, which was forgotten last time:
(lost-found is really growing in a pace it will take me very long to find my 
lost stash.)

5) fsck --full --lost-found shows me a lot of "dangling commit". I would like 
to clean them up. prune did only remove "dangling tree" and blobs.
(Reason: Last time I droped a stash accidently, I was able to find it in that 
list. I will not be able to do this again if it continues to grow at that 
rate.)
How can I do that?
Further fsck --full --unreachable also shows a lot of unreachable things 
(commits, trees, blobs). Can that be cleaned up as well?

Greetings,
Dennis

Again: Please CC me, as I am not subscribed.

```

## Brandon Casey, 2008-06-06 21:19

Subject: Re: Multiple user questions
Message-ID: <fa67IkKd22OcyCOfHZx_EORkS5DPZLP5IEWlE3dg-pOOdKgeIL0hpA@cipher.nrlssc.navy.mil>
URL: https://gitlist.dev/e/fa67IkKd22OcyCOfHZx_EORkS5DPZLP5IEWlE3dg-pOOdKgeIL0hpA%40cipher.nrlssc.navy.mil
In-Reply-To: <200806062247.42074.devurandom@gmx.net>

```
Dennis Schridde wrote:
> I just ran into a lost stash again and thus would like to get an answer to 
> this question, which was forgotten last time:
> (lost-found is really growing in a pace it will take me very long to find my 
> lost stash.)

How did you lose it?

If you did 'git stash drop' and then realized that you dropped the wrong stash,
you can apply that stash and then recreate it since 'stash drop' also prints out
the sha1 and 'stash apply' can use that.

For example:

   # edit edit edit
   $ git stash
   # hmm I don't need that old stash anymore
   $ git stash drop
   Dropped refs/stash@{0} (5dcea62df980fa157e7755f82125dfc3bbd52ff5)
   # whoops I didn't mean to drop _that_ stash
   $ git stash apply 5dcea62df980fa157e7755f82125dfc3bbd52ff5
   $ git stash

Of course, that only works if you realize pretty quickly that you dropped the
wrong stash. Also realize my example was rather simplified and the working
directory may need to be prepped before reapplying the dropped stash.

-brandon

```

## Dennis Schridde, 2008-06-06 22:15

Subject: Re: Multiple user questions
Message-ID: <200806070015.29709.devurandom@gmx.net>
URL: https://gitlist.dev/e/200806070015.29709.devurandom%40gmx.net
In-Reply-To: <fa67IkKd22OcyCOfHZx_EORkS5DPZLP5IEWlE3dg-pOOdKgeIL0hpA@cipher.nrlssc.navy.mil>

```
Am Freitag, 6. Juni 2008 23:19:49 schrieben Sie:
> Dennis Schridde wrote:
> > I just ran into a lost stash again and thus would like to get an answer
> > to this question, which was forgotten last time:
> > (lost-found is really growing in a pace it will take me very long to find
> > my lost stash.)
>
> How did you lose it?
>
> If you did 'git stash drop' and then realized that you dropped the wrong
> stash, you can apply that stash and then recreate it since 'stash drop'
> also prints out the sha1 and 'stash apply' can use that.
>
> For example:
>
>    # edit edit edit
>    $ git stash
>    # hmm I don't need that old stash anymore
>    $ git stash drop
>    Dropped refs/stash@{0} (5dcea62df980fa157e7755f82125dfc3bbd52ff5)
>    # whoops I didn't mean to drop _that_ stash
>    $ git stash apply 5dcea62df980fa157e7755f82125dfc3bbd52ff5
>    $ git stash
>
> Of course, that only works if you realize pretty quickly that you dropped
> the wrong stash. Also realize my example was rather simplified and the
> working directory may need to be prepped before reapplying the dropped
> stash.
It was indeed too late. (I assumed to have rerecorded the stash, but later 
realised that the new stash contained only parts of the changes.)

I am now using this script:
for commit in $(git fsck --full --lost-found | grep commit | awk '{print 
$3}') ; do
        git show ${commit} | head -n7 | \
                grep "On ${branch}:" | grep "${message}" > /dev/null \
                && git show ${commit} | head -n7
done

Though that list grows pretty long, so I would like to cut down the output of 
fsck-lost-found after I am sure nothing worthy is "lost" anymore.

--Dennis

```
