# `git stash apply` deleted a random dir from my working copy

3 messages from 2016-11-03 to 2016-11-03. Participants: Stefan Monov.
Thread: https://gitlist.dev/t/44421

## Stefan Monov, 2016-11-03 16:06

Subject: `git stash apply` deleted a random dir from my working copy
Message-ID: <CAJtFkWsUL=9K=VGTDejE+4RR3HJevk+2aRAhUyf8-mDrqi5MRg@mail.gmail.com>
URL: https://gitlist.dev/e/CAJtFkWsUL%3D9K%3DVGTDejE%2B4RR3HJevk%2B2aRAhUyf8-mDrqi5MRg%40mail.gmail.com

```
Hi.

I just tried `git stash save` for the first time. It worked fine. Then
I tried `git stash apply` and while my uncommitted changes were
restored, another effect was that a random dir from the root of my
working copy was deleted. I don't know why it chose that exact dir,
there's lots of other dirs like it in the root.

`git stash save` output and shortened `git stash apply` output are attached.

Note: The dir that got deleted was a committed and pushed dir. It had
no uncommitted local changes.

It's not a huge problem, because there was no data loss - I can pull
the deleted data back from the repo. But I'd still like to know why
this problem happened.

TIA, Stefan Monov


Saved working directory and index state WIP on clipping: cfeac4b - applying the solution from http://stackoverflow.com/questions/40385482/why-cant-i-use-opengl-es-3-0-in-qt
HEAD is now at cfeac4b - applying the solution from http://stackoverflow.com/questions/40385482/why-cant-i-use-opengl-es-3-0-in-qt

Removing debug_stencil_not_working/textureandlight.js
Removing debug_stencil_not_working/qtlogo.png
[... more removes here ...]
On branch clipping
Changes to be committed:
  (use "git reset HEAD <file>..." to unstage)

		new file:   documentation/textureSize_missing.txt

Changes not staged for commit:
  (use "git add/rm <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

		deleted:    ../debug_stencil_not_working/qtlogo.png
		deleted:    ../debug_stencil_not_working/textureandlight.js
		[... more deleted files here ...]
		modified:   main.cpp
		modified:   main.qml
		[... more modified files here ...]

Untracked files:
  (use "git add <file>..." to include in what will be committed)

		../dbg_repeater/dbg_repeater.pro.user
		debug_stencil_not_working/
		[... more files and dirs here ...]
```

## Stefan Monov, 2016-11-03 17:01

Subject: Re: `git stash apply` deleted a random dir from my working copy
Message-ID: <CAJtFkWu1qf3xFg1-B-xVONOmqQZfJhe4+qAb4E3H2A5-st_2dw@mail.gmail.com>
URL: https://gitlist.dev/e/CAJtFkWu1qf3xFg1-B-xVONOmqQZfJhe4%2BqAb4E3H2A5-st_2dw%40mail.gmail.com
In-Reply-To: <CAJtFkWsUL=9K=VGTDejE+4RR3HJevk+2aRAhUyf8-mDrqi5MRg@mail.gmail.com>

```
Actually, I just tried restoring my dir with `git pull origin
clipping`, but that didn't restore it. So, besides the question "why
did it get deleted", I'd like to ask "how do I restore it?", as well.

On Thu, Nov 3, 2016 at 6:06 PM, Stefan Monov <logixoul@gmail.com> wrote:
> Hi.
>
> I just tried `git stash save` for the first time. It worked fine. Then
> I tried `git stash apply` and while my uncommitted changes were
> restored, another effect was that a random dir from the root of my
> working copy was deleted. I don't know why it chose that exact dir,
> there's lots of other dirs like it in the root.
>
> `git stash save` output and shortened `git stash apply` output are attached.
>
> Note: The dir that got deleted was a committed and pushed dir. It had
> no uncommitted local changes.
>
> It's not a huge problem, because there was no data loss - I can pull
> the deleted data back from the repo. But I'd still like to know why
> this problem happened.
>
> TIA, Stefan Monov

```

## Stefan Monov, 2016-11-03 17:04

Subject: Re: `git stash apply` deleted a random dir from my working copy
Message-ID: <CAJtFkWt8VEGHAigx7Wd49mj6erdM=y_jFbhQ+xaMaAsk91EmWg@mail.gmail.com>
URL: https://gitlist.dev/e/CAJtFkWt8VEGHAigx7Wd49mj6erdM%3Dy_jFbhQ%2BxaMaAsk91EmWg%40mail.gmail.com
In-Reply-To: <CAJtFkWu1qf3xFg1-B-xVONOmqQZfJhe4+qAb4E3H2A5-st_2dw@mail.gmail.com>

```
Scratch my last message, I figured out how to restore it. In the
TortoiseGit context menu I selected "Diff", and in the list the
deleted files were listed as "missing". I selected them all, right
clicked them, and selected "revert". Still don't know why the dir got
deleted in the first place though.

On Thu, Nov 3, 2016 at 7:01 PM, Stefan Monov <logixoul@gmail.com> wrote:
> Actually, I just tried restoring my dir with `git pull origin
> clipping`, but that didn't restore it. So, besides the question "why
> did it get deleted", I'd like to ask "how do I restore it?", as well.
>
> On Thu, Nov 3, 2016 at 6:06 PM, Stefan Monov <logixoul@gmail.com> wrote:
>> Hi.
>>
>> I just tried `git stash save` for the first time. It worked fine. Then
>> I tried `git stash apply` and while my uncommitted changes were
>> restored, another effect was that a random dir from the root of my
>> working copy was deleted. I don't know why it chose that exact dir,
>> there's lots of other dirs like it in the root.
>>
>> `git stash save` output and shortened `git stash apply` output are attached.
>>
>> Note: The dir that got deleted was a committed and pushed dir. It had
>> no uncommitted local changes.
>>
>> It's not a huge problem, because there was no data loss - I can pull
>> the deleted data back from the repo. But I'd still like to know why
>> this problem happened.
>>
>> TIA, Stefan Monov

```
