Search code examples
gitgitignore

Difference between *.zip and .zip in .gitignore (zip is a example)


In .gitignore I specified .zip and it didn't work. But when I did *.zip it filtered my files to be commited.

What's the difference between these two?


Solution

  • .gitignore is looking for file names or glob patterns, not extensions.

    Without the wildcard, .zip in your .gitignore is only matching a literal file called .zip, which is unlikely to exist, but if you were to create it (say by calling touch .zip you'd find that git correctly ignores it.