git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Feature Request: gitignore recursion

From
Karsten Blees <karsten.blees@gmail.com>
Date
Oct 10, 2013, 07:59 UTC
Message-ID
<52565E51.7050401@gmail.com>
In-Reply-To
<CACsJy8CHcyDrzieX1Ps3LU2UxCP+QJdv9+5BXZj9Mw2bMs5v3w@mail.gmail.com>
Show 11 quoted lines
> On Mon, Oct 7, 2013 at 5:23 AM, AJ <allj...@gmail.com> wrote:
>> I'm hoping to get the following feature implemented into git.
>>
>> Add the ability to recursively include using:
>> !/my_dir/**/*
> 
> 
> You can do that since v1.8.2. Actually the pattern should be
> 
> !/my_dir/**
> 
Another solution to include just one specific directory:
  /*
  !/wp-content
  /wp-content/*
  !/wp-content/themes
Note the "/*", instead of "*" which matches everything everywhere.
> Checkout gitignore man page for more information.
> 
The compiled version reads like this:
"A trailing "/" matches everything inside. For example, "abc/" matches all files inside directory "abc"..."
--- 8< ---
Subject: [PATCH] gitignore.txt: fix documentation of "**" patterns
"**" means bold in ASCIIDOC, so we need to escape it.
Signed-off-by: Karsten Blees <blees@dcon.de>
---
 Documentation/gitignore.txt | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/Documentation/gitignore.txt b/Documentation/gitignore.txt
index 54e334e..f971960 100644
--- a/Documentation/gitignore.txt
+++ b/Documentation/gitignore.txt
@@ -113,12 +113,12 @@ full pathname may have special meaning:
 
  - A leading "`**`" followed by a slash means match in all
    directories. For example, "`**/foo`" matches file or directory
-   "`foo`" anywhere, the same as pattern "`foo`". "**/foo/bar"
+   "`foo`" anywhere, the same as pattern "`foo`". "`**/foo/bar`"
    matches file or directory "`bar`" anywhere that is directly
    under directory "`foo`".
 
- - A trailing "/**" matches everything inside. For example,
-   "abc/**" matches all files inside directory "abc", relative
+ - A trailing "`/**`" matches everything inside. For example,
+   "`abc/**`" matches all files inside directory "`abc`", relative
    to the location of the `.gitignore` file, with infinite depth.
 
  - A slash followed by two consecutive asterisks then a slash
-- 
1.8.4.msysgit.1
Previous: Jeff King
Message 7 of 7 in “Feature Request: gitignore recursion”
  1. AJOct 6, 2013
  2. Duy NguyenOct 7, 2013
  3. Jeff KingOct 7, 2013
  4. Duy NguyenOct 7, 2013
  5. Karsten BleesOct 10, 2013
  6. Jeff KingOct 10, 2013
  7. Karsten BleesOct 10, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.