From: Dan Drake <dan@dandrake.org>
To: "git@vger.kernel.org" <git@vger.kernel.org>
Subject: gitignore documentation for info/exclude files and patterns with relative directories
Date: Fri, 27 Mar 2026 11:20:42 +0000 [thread overview]
Message-ID: <Qdk5yVH_yWgKl_bjCjdasusfe3PuzHCZ2rKgKIn2Xx5rcw46jmQDfA6K2vkv3V3XLSy4aqwyUlfVEmF5VlIv3EVEOlZLEnf-paw11tyhZKE=@dandrake.org> (raw)
Hello,
In the "pattern format" section of the gitignore manpage, it says:
> The slash "/" is used as the directory separator. Separators may occur at the
> beginning, middle or end of the .gitignore search pattern.
>
> If there is a separator at the beginning or middle (or both) of the pattern,
> then the pattern is relative to the directory level of the particular
> .gitignore file itself. Otherwise the pattern may also match at any
> level below the .gitignore level.
For a .git/info/exclude file, the above makes it sound like the pattern will be
relative to that .git/info directory, so that you would need to use this kind of p
attern to match files starting with 'foo' in the root of the repo:
../../foo*
However, it seems that for patterns in the info/exclude file, the beginning
slash anchors the pattern to the root of the repo; the above pattern
in that file should be '/foo*'.
The documentation should mention this behavior for info/exclude, as well as
the core.excludesFile.
Dan
--
Ceci n'est pas une .signature.
next reply other threads:[~2026-03-27 11:26 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-27 11:20 Dan Drake [this message]
2026-03-27 16:18 ` gitignore documentation for info/exclude files and patterns with relative directories Junio C Hamano
2026-03-28 15:21 ` [PATCH] doc: gitignore: clarify pattern base for info/exclude and core.excludesFile Shreyansh Paliwal
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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='Qdk5yVH_yWgKl_bjCjdasusfe3PuzHCZ2rKgKIn2Xx5rcw46jmQDfA6K2vkv3V3XLSy4aqwyUlfVEmF5VlIv3EVEOlZLEnf-paw11tyhZKE=@dandrake.org' \
--to=dan@dandrake.org \
--cc=git@vger.kernel.org \
/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.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).