Here is the content of my current directory.
$ ls
foo.foo
$ ls -a
. .. .bar.foo .foo foo.foo .gitignore
Then I turn this directory int
gitignore use of '*' follows the glob convention:
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".
The OP Lone Learner asks in the comments:
Does the shell also use fnmatch(3) to process glob patterns?
In that case why does*not match zero characters before. (i.e. hidden files) but gitignore does?
Because that is a shell configuration choice.
Type (using shopt, which is specific to bash):
shopt -s dotglob
echo *.foo
.foo foo.foo
That is using dotglob
If set, Bash includes filenames beginning with a '
.' in the results of filename expansion. (for pattern matching)