# git clean ignore

3 messages from 2026-02-07 to 2026-02-08. Participants: Sylvain Rabot, Kristoffer Haugsbakk, D. Ben Knoble.
Thread: https://gitlist.dev/t/64937

## Sylvain Rabot, 2026-02-07 14:53

Subject: git clean ignore
Message-ID: <CADjtP1FSAQZRyBCjPZ00Y2g=fdtRZWHP44XLqjor-OrYXAN-vw@mail.gmail.com>
URL: https://gitlist.dev/e/CADjtP1FSAQZRyBCjPZ00Y2g%3DfdtRZWHP44XLqjor-OrYXAN-vw%40mail.gmail.com

```
Hi,

I'm a big user of git clean -fdx which is the shortest path to a clean worktree.

However, I repeatedly found myself deleting precious git ignored
resources such as editor/debug configurations so I asked myself if the
git ignore mechanism could be applied to git clean so that we can
declare a list of patterns git clean should never remove.

I launched an AI agent on this and here is the result:
https://github.com/sylr/git/commit/13d0177c52130782bcf7877895a5b497abdfba86

Since I'm no C developer I'm not really qualified to review the AI
output but it seems to do what I wanted. I'm not expecting it to be
merged but I am wondering if this is a feature git would be likely to
implement ?

Regards.

-- 
Sylvain Rabot <sylvain@abstraction.fr>

```

## Kristoffer Haugsbakk, 2026-02-07 15:00

Subject: Re: git clean ignore
Message-ID: <c5d1faf0-a7ea-4be0-b9eb-3bcb5f1ae0a2@app.fastmail.com>
URL: https://gitlist.dev/e/c5d1faf0-a7ea-4be0-b9eb-3bcb5f1ae0a2%40app.fastmail.com
In-Reply-To: <CADjtP1FSAQZRyBCjPZ00Y2g=fdtRZWHP44XLqjor-OrYXAN-vw@mail.gmail.com>

```
On Sat, Feb 7, 2026, at 15:53, Sylvain Rabot wrote:
> Hi,
>
> I'm a big user of git clean -fdx which is the shortest path to a clean worktree.
>
> However, I repeatedly found myself deleting precious git ignored
> resources such as editor/debug configurations so I asked myself if the
> git ignore mechanism could be applied to git clean so that we can
> declare a list of patterns git clean should never remove.
>[snip]

Related: https://lore.kernel.org/git/pull.1627.git.1703643931314.gitgitgadget@gmail.com/T/#u

```

## D. Ben Knoble, 2026-02-08 02:28

Subject: Re: git clean ignore
Message-ID: <CALnO6CAS5bpxDuqZ1Tf=SeY5Z6JpRpm1vbPCUtnyj6AsNqGJ8Q@mail.gmail.com>
URL: https://gitlist.dev/e/CALnO6CAS5bpxDuqZ1Tf%3DSeY5Z6JpRpm1vbPCUtnyj6AsNqGJ8Q%40mail.gmail.com
In-Reply-To: <CADjtP1FSAQZRyBCjPZ00Y2g=fdtRZWHP44XLqjor-OrYXAN-vw@mail.gmail.com>

```
On Sat, Feb 7, 2026 at 9:53 AM Sylvain Rabot <sylvain@abstraction.fr> wrote:
>
> Hi,
>
> I'm a big user of git clean -fdx which is the shortest path to a clean worktree.

If you can't drop -x for some reason, consider "git worktree add" ?

-- 
D. Ben Knoble

```
