# Advice on per-worktree private gitignore?

2 messages from 2026-04-23 to 2026-04-23. Participants: D. Ben Knoble, brian m. carlson.
Thread: https://gitlist.dev/t/65545

## D. Ben Knoble, 2026-04-23 21:26

Subject: Advice on per-worktree private gitignore?
Message-ID: <CALnO6CCXmA+ATT7CuyWkU6P8qmLCCpMi5Ppr1c78s0heznpVyw@mail.gmail.com>

```
Today we have $GIT_DIR/info/exclude for the main worktree, but $(git
rev-parse --git-dir)/info/exclude for secondary worktrees does not
actually contribute to ignore specs.

Is this a "we never got around to implementing that", an intentional
omission, or something else? Since --git-dir is described as parsing
$GIT_DIR, I would naturally combine that with the gitignore(1) manual
to think that the worktree.git/info/exclude should work.

(Currently it seems that main-worktree/.git/info/exclude applies to
all worktrees, which may not be desirable in some circumstances.)

Thanks,
-- 
D. Ben Knoble

```

## brian m. carlson, 2026-04-23 21:56

Subject: Re: Advice on per-worktree private gitignore?
Message-ID: <aeqVpjPSyyvHDLWR@fruit.crustytoothpaste.net>
In-Reply-To: <CALnO6CCXmA+ATT7CuyWkU6P8qmLCCpMi5Ppr1c78s0heznpVyw@mail.gmail.com>

```
On 2026-04-23 at 21:26:05, D. Ben Knoble wrote:
> Today we have $GIT_DIR/info/exclude for the main worktree, but $(git
> rev-parse --git-dir)/info/exclude for secondary worktrees does not
> actually contribute to ignore specs.
> 
> Is this a "we never got around to implementing that", an intentional
> omission, or something else? Since --git-dir is described as parsing
> $GIT_DIR, I would naturally combine that with the gitignore(1) manual
> to think that the worktree.git/info/exclude should work.
> 
> (Currently it seems that main-worktree/.git/info/exclude applies to
> all worktrees, which may not be desirable in some circumstances.)

I'm not aware of it being an intentional omission.  I think what you
want might be useful in some circumstances, but there also might be
circumstances where it's not wanted and the user might want the settings
in the main worktree to be used everywhere.

So I'd say that we could add it as an optional extension, like
`extensions.worktreeConfig`.
-- 
brian m. carlson (they/them)
Toronto, Ontario, CA

```
