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

Re: Missing ? wildcard character in gitignore documentation

From
JFJack F <jack@bytes.nz>
Date
Jan 29, 2018, 16:07 UTC
Message-ID
<6c66708f-cd86-2c54-fc8c-b1260abfadd8@bytes.nz>
In-Reply-To
<000f01d39918$70009eb0$5001dc10$@nexbridge.com>

Ah. Yes it does. Apologies. Maybe a "See glob(7) for more pattern matching options, including ! ? [] *"

Thank you very much.
Cheers.

From, Jack

On 29/01/18 15:47, Randall S. Becker wrote:
Show 48 quoted lines
> On January 29, 2018 6:30 AM, Jack F wrote:
>> I have just noticed that the documentation for gitignore is missing
>> documentation on using the ? to match any single character. I have included
>> a example below with git version 2.14.1.
>>
>> |11:05:09 j ~/Development/ls-ignore [master] $ git status On branch
>> master Your branch is up-to-date with 'origin/master'. nothing to commit,
>> working tree clean 11:05:11 j ~/Development/ls-ignore [master] $ cat
>> .gitignore *~ node_modules yarn* 11:05:21 j ~/Development/ls-ignore
>> [master] $ touch test.swo 11:05:31 j ~/Development/ls-ignore [master]?1 $
>> git status On branch master Your branch is up-to-date with 'origin/master'.
>> Untracked files: (use "git add <file>..." to include in what will be committed)
>> test.swo nothing added to commit but untracked files present (use "git add"
>> to track) 11:05:35 j ~/Development/ls-ignore [master]?1 $ echo "*.sw?" >>
>> .gitignore 11:05:40 j ~/Development/ls-ignore [master]≠1 $ cat .gitignore *~
>> node_modules
>> yarn* *.sw? 11:05:51 j ~/Development/ls-ignore [master]≠1 $ git status On
>> branch master Your branch is up-to-date with 'origin/master'. Changes not
>> staged for commit: (use "git add <file>..." to update what will be
>> committed) (use "git checkout -- <file>..." to discard changes in working
>> directory) modified: .gitignore no changes added to commit (use "git add"
>> and/or "git commit -a")|
>>
>>
>>
>> Noticed it when checking an npm package (ignore) that uses the
>> documentation (https://git-scm.com/docs/gitignore) to determine its
>> functionality. It is documented in https://git-scm.com/book/en/v2/Git-
>> Basics-Recording-Changes-to-the-Repository#Ignoring-Files
> The implication of support for ? is there through the following paragraph from the gitignore documentation:
>
>     "Otherwise, Git treats the pattern as a shell glob suitable for consumption by fnmatch(3)
>     with the FNM_PATHNAME flag: wildcards in the pattern will not match a / in the
>     pathname. For example, "Documentation/*.html" matches "Documentation/git.html"
>     but not "Documentation/ppc/ppc.html" or "tools/perf/Documentation/perf.html"."
>
> Of course you have to go read fnmatch(3), so it might be good for expand on this here :).
>
> Cheers,
> Randall
>
> -- Brief whoami:
>  NonStop developer since approximately 211288444200000000
>  UNIX developer since approximately 421664400
> -- In my real life, I talk too much.
>
>
>
-- 
https://bytes.nz
https://keybase.io/bytesnz
Previous: Randall S. BeckerNext: Duy Nguyen
Message 3 of 6 in “Missing ? wildcard character in gitignore documentation”
  1. Jack FJan 29, 2018
  2. Randall S. BeckerJan 29, 2018
  3. Jack FJan 29, 2018
  4. Duy NguyenJan 30, 2018
  5. Ævar Arnfjörð BjarmasonJan 30, 2018
  6. Duy NguyenJan 30, 2018

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.