# git clean -fdx deletes tracked files

4 messages from 2017-08-15 to 2017-08-17. Participants: Kim Birkelund, Kevin Daudt, Andrew Ardill.
Thread: https://gitlist.dev/t/46594

## Kim Birkelund, 2017-08-15 18:45

Subject: git clean -fdx deletes tracked files
Message-ID: <CAOCG=_p--J5PKGrQTdquMvcBNQs67MNaN3vM8Tbwn2nZNwVR+Q@mail.gmail.com>
URL: https://gitlist.dev/e/CAOCG%3D_p--J5PKGrQTdquMvcBNQs67MNaN3vM8Tbwn2nZNwVR%2BQ%40mail.gmail.com

```
Hi

I hope this is gonna sound as weird to you as it does to me.

The link below is a zip of a small git repository that I can reproduce
the bug in on 2 machines.

Repo: https://www.dropbox.com/s/fz4d0i5ko7s7ktr/test.zip?dl=0

It contains 2 folders: helpers and b, each of which is an empty npm
module. b\package.json refers to the helpers module.

The following reproduces the bug:

1) in terminal cd to the b folder
2) run npm install
3) run git reset HEAD --hard
4) run git clean -fdx

At this point both files in the helpers folder has been deleted and
running git status confirms this.

Tool version:

git --version => git version 2.10.2.windows.1
node -v => v6.11.2
npm -v => 5.3.0


I have no idea what is going. Very much hope you can explain :-)

```

## Kevin Daudt, 2017-08-15 19:25

Subject: Re: git clean -fdx deletes tracked files
Message-ID: <20170815192543.GB3839@alpha.vpn.ikke.info>
URL: https://gitlist.dev/e/20170815192543.GB3839%40alpha.vpn.ikke.info
In-Reply-To: <CAOCG=_p--J5PKGrQTdquMvcBNQs67MNaN3vM8Tbwn2nZNwVR+Q@mail.gmail.com>

```
On Tue, Aug 15, 2017 at 08:45:20PM +0200, Kim Birkelund wrote:
> Hi
> 
> I hope this is gonna sound as weird to you as it does to me.
> 
> The link below is a zip of a small git repository that I can reproduce
> the bug in on 2 machines.
> 
> Repo: https://www.dropbox.com/s/fz4d0i5ko7s7ktr/test.zip?dl=0
> 
> It contains 2 folders: helpers and b, each of which is an empty npm
> module. b\package.json refers to the helpers module.
> 
> The following reproduces the bug:
> 
> 1) in terminal cd to the b folder
> 2) run npm install
> 3) run git reset HEAD --hard
> 4) run git clean -fdx
> 
> At this point both files in the helpers folder has been deleted and
> running git status confirms this.
> 
> Tool version:
> 
> git --version => git version 2.10.2.windows.1
> node -v => v6.11.2
> npm -v => 5.3.0
> 
> 
> I have no idea what is going. Very much hope you can explain :-)

I cannot reproduce it on linux.

git clean -fdx output:

  Removing node_modules/
  Removing package-lock.json

These are all untracked, and nothing in the helpers dir is being
removed.


```

## Kim Birkelund, 2017-08-16 06:47

Subject: Re: git clean -fdx deletes tracked files
Message-ID: <CAOCG=_pKCXbsRtxNN3+qn+28i_1ZXZJ4Nyf2LLSF78irbyoqFA@mail.gmail.com>
URL: https://gitlist.dev/e/CAOCG%3D_pKCXbsRtxNN3%2Bqn%2B28i_1ZXZJ4Nyf2LLSF78irbyoqFA%40mail.gmail.com
In-Reply-To: <20170815192543.GB3839@alpha.vpn.ikke.info>

```
Apologies. I should obviously have mentioned which OSes the machines I
tested on ran.

One Windows 10 (fully updated) and one Windows Server 2016 (also
updated). I've also seen it in a real repository on our build server
which is Windows Server 2012 R2.

After my first mail I updated git to latest and could still reproduce.



On Aug 15, 2017 21:25, "Kevin Daudt" <me@ikke.info> wrote:

On Tue, Aug 15, 2017 at 08:45:20PM +0200, Kim Birkelund wrote:
> Hi
>
> I hope this is gonna sound as weird to you as it does to me.
>
> The link below is a zip of a small git repository that I can reproduce
> the bug in on 2 machines.
>
> Repo: https://www.dropbox.com/s/fz4d0i5ko7s7ktr/test.zip?dl=0
>
> It contains 2 folders: helpers and b, each of which is an empty npm
> module. b\package.json refers to the helpers module.
>
> The following reproduces the bug:
>
> 1) in terminal cd to the b folder
> 2) run npm install
> 3) run git reset HEAD --hard
> 4) run git clean -fdx
>
> At this point both files in the helpers folder has been deleted and
> running git status confirms this.
>
> Tool version:
>
> git --version => git version 2.10.2.windows.1
> node -v => v6.11.2
> npm -v => 5.3.0
>
>
> I have no idea what is going. Very much hope you can explain :-)

I cannot reproduce it on linux.

git clean -fdx output:

  Removing node_modules/
  Removing package-lock.json

These are all untracked, and nothing in the helpers dir is being
removed.

```

## Andrew Ardill, 2017-08-17 00:12

Subject: Re: git clean -fdx deletes tracked files
Message-ID: <CAH5451==kzQxbmVmbVT5JeTDSJGY05B0hzFyvnBMndv-iGg7Xw@mail.gmail.com>
URL: https://gitlist.dev/e/CAH5451%3D%3DkzQxbmVmbVT5JeTDSJGY05B0hzFyvnBMndv-iGg7Xw%40mail.gmail.com
In-Reply-To: <CAOCG=_pKCXbsRtxNN3+qn+28i_1ZXZJ4Nyf2LLSF78irbyoqFA@mail.gmail.com>

```
Hi Kim,

I have cc'd the git for windows mailing list, but doing a quick search
on the bug tracker shows this issue which looks related:
https://github.com/git-for-windows/git/issues/607

Hope that helps, seems like it may be an issue with how junctions on
windows are handled by git.

Regards,

Andrew Ardill


On 16 August 2017 at 16:47, Kim Birkelund <kim@birkelund.me> wrote:
> Apologies. I should obviously have mentioned which OSes the machines I
> tested on ran.
>
> One Windows 10 (fully updated) and one Windows Server 2016 (also
> updated). I've also seen it in a real repository on our build server
> which is Windows Server 2012 R2.
>
> After my first mail I updated git to latest and could still reproduce.
>
>
>
> On Aug 15, 2017 21:25, "Kevin Daudt" <me@ikke.info> wrote:
>
> On Tue, Aug 15, 2017 at 08:45:20PM +0200, Kim Birkelund wrote:
>> Hi
>>
>> I hope this is gonna sound as weird to you as it does to me.
>>
>> The link below is a zip of a small git repository that I can reproduce
>> the bug in on 2 machines.
>>
>> Repo: https://www.dropbox.com/s/fz4d0i5ko7s7ktr/test.zip?dl=0
>>
>> It contains 2 folders: helpers and b, each of which is an empty npm
>> module. b\package.json refers to the helpers module.
>>
>> The following reproduces the bug:
>>
>> 1) in terminal cd to the b folder
>> 2) run npm install
>> 3) run git reset HEAD --hard
>> 4) run git clean -fdx
>>
>> At this point both files in the helpers folder has been deleted and
>> running git status confirms this.
>>
>> Tool version:
>>
>> git --version => git version 2.10.2.windows.1
>> node -v => v6.11.2
>> npm -v => 5.3.0
>>
>>
>> I have no idea what is going. Very much hope you can explain :-)
>
> I cannot reproduce it on linux.
>
> git clean -fdx output:
>
>   Removing node_modules/
>   Removing package-lock.json
>
> These are all untracked, and nothing in the helpers dir is being
> removed.

```
