Difference in the paths in .gitignore file?

gitignore

Solution

This depends on the behavior of your shell. Git doesn't do any work to determine how to expand these. In general, `*` matches any single file or folder:

/a/*/z
 matches        /a/b/z
 matches        /a/c/z
 doesn't match  /a/b/c/z

`**` matches any string of folders:

/a/**/z
 matches        /a/b/z
 matches        /a/b/c/z
 matches        /a/b/c/d/e/f/g/h/i/z
 doesn't match  /a/b/c/z/d.pr0n

Combine `**` with `*` to match files in an entire folder tree:

/a/**/z/*.pr0n
 matches        /a/b/c/z/d.pr0n
 matches        /a/b/z/foo.pr0n
 doesn't match  /a/b/z/bar.txt

Problem

I've been using git but still having confusion about the .gitignore file paths. So, what is the difference between the following two paths in .gitignore file? ``` tmp/* public/documents/**/* ``` I can understand that `tmp/*` will ignore all the files and folders inside it. Am I right? But what does that second line path mean?

Original source

Related problems