From: "D. Ben Knoble" <ben.knoble+github@gmail.com>
To: git@vger.kernel.org
Cc: "D. Ben Knoble" <ben.knoble+github@gmail.com>,
"brian m . carlson" <sandals@crustytoothpaste.net>,
Patrick Steinhardt <ps@pks.im>, Taylor Blau <me@ttaylorr.com>,
Caleb White <cdwhite3@pm.me>, Calvin Wan <calvinwan@google.com>,
Junio C Hamano <gitster@pobox.com>,
Elijah Newren <newren@gmail.com>,
Andrew Berry <andrew@furrypaws.ca>, Jeff King <peff@peff.net>,
Derrick Stolee <stolee@gmail.com>,
Phillip Wood <phillip.wood@dunelm.org.uk>
Subject: [PATCH v2] ignore: note info/exclude lives in GIT_COMMON_DIR, not GIT_DIR
Date: Fri, 8 May 2026 10:14:14 -0400 [thread overview]
Message-ID: <d58b6e921d3005c6170fc6c47f175214acb3fa68.1778249267.git.ben.knoble+github@gmail.com> (raw)
In-Reply-To: <e3ee0a11b566dd2cc605447c111ae4620bce0fe6.1777050300.git.ben.knoble+github@gmail.com>
gitignore(5) says that the per-repository ignore file is
$GIT_DIR/info/exclude, but in a worktree that is not the case:
git rev-parse --git-path info/exclude
/path/to/main/worktree/.git/info/exclude
git rev-parse --git-common-dir
/path/to/main/worktree/.git
We actually use $GIT_COMMON_DIR/info/exclude. Adjust the documentation
to say so.
Signed-off-by: D. Ben Knoble <ben.knoble+github@gmail.com>
---
Notes (benknoble/commits):
Changes in v2:
Only adjust the documentation.
brian points out that a more general extension would allow using more
info/ files as "per-worktree," which I don't have the impetus to
implement myself.
Phillip and Junio asked for a concrete use case:
A colleague is developing a tool for managing the "skill files" of
various LLM tools (Claude, Windsurf, etc.). The files have
requirements that make it hard to generically ignore them (e.g.,
filenames and front-matter have to match), but different tasks
(corresponding to worktrees) may want different active skills, so it
is desirable to ignore the files. Think of this like node_modules.
Unfortunately, since per-worktree ignores don't work, the current
solution is to put a .gitignore file in the corresponding directory
with the installed skills that ignores itself and the installed
skills.
Since overall reactions seem fairly negative (or require a more general
extension, which I think is probably the right course but not simply
implemented), I've opted to adjust the docs. They originally confused
me, as I was surprised when my colleague reported that per-worktree
ignores didn't work (the docs imply they should by use of $GIT_DIR).
Link to v1: <e3ee0a11b566dd2cc605447c111ae4620bce0fe6.1777050300.git.ben.knoble+github@gmail.com>
v1 notes:
Discussed briefly at https://lore.kernel.org/git/CALnO6CCXmA+ATT7CuyWkU6P8qmLCCpMi5Ppr1c78s0heznpVyw@mail.gmail.com/T
This is based on next (4f69b47b94 (Merge branch 'ps/test-set-e-clean'
into next, 2026-04-23)) but cleanly applies to master (94f057755b (Git
2.54, 2026-04-19)) and seen (50541634cb (Merge branch
'js/parseopt-subcommand-autocorrection' into seen, 2026-04-23)).
Documentation/gitignore.adoc | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/Documentation/gitignore.adoc b/Documentation/gitignore.adoc
index a3d24e5c34..c423b650de 100644
--- a/Documentation/gitignore.adoc
+++ b/Documentation/gitignore.adoc
@@ -7,7 +7,7 @@ gitignore - Specifies intentionally untracked files to ignore
SYNOPSIS
--------
-$XDG_CONFIG_HOME/git/ignore, $GIT_DIR/info/exclude, .gitignore
+$XDG_CONFIG_HOME/git/ignore, $GIT_COMMON_DIR/info/exclude, .gitignore
DESCRIPTION
-----------
@@ -34,7 +34,7 @@ precedence, the last matching pattern decides the outcome):
includes such `.gitignore` files in its repository, containing patterns for
files generated as part of the project build.
- * Patterns read from `$GIT_DIR/info/exclude`.
+ * Patterns read from `$GIT_COMMON_DIR/info/exclude`.
* Patterns read from the file specified by the configuration
variable `core.excludesFile`.
base-commit: 4f69b47b940100b02630f745a52f9d9850f122b2
--
2.54.0.564.ge3ee0a11b5.dirty
next prev parent reply other threads:[~2026-05-08 14:15 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-24 17:09 [PATCH] dir: use per-worktree repository ignore patterns upon request D. Ben Knoble
2026-04-24 19:35 ` brian m. carlson
2026-04-24 19:53 ` Phillip Wood
2026-04-25 3:06 ` Junio C Hamano
2026-05-08 14:14 ` D. Ben Knoble [this message]
2026-05-09 14:08 ` [PATCH v2] ignore: note info/exclude lives in GIT_COMMON_DIR, not GIT_DIR brian m. carlson
2026-05-11 10:30 ` Phillip Wood
2026-05-11 19:55 ` D. Ben Knoble
2026-05-12 21:21 ` [PATCH v3] " D. Ben Knoble
2026-05-13 14:02 ` Phillip Wood
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=d58b6e921d3005c6170fc6c47f175214acb3fa68.1778249267.git.ben.knoble+github@gmail.com \
--to=ben.knoble+github@gmail.com \
--cc=andrew@furrypaws.ca \
--cc=calvinwan@google.com \
--cc=cdwhite3@pm.me \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=me@ttaylorr.com \
--cc=newren@gmail.com \
--cc=peff@peff.net \
--cc=phillip.wood@dunelm.org.uk \
--cc=ps@pks.im \
--cc=sandals@crustytoothpaste.net \
--cc=stolee@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox