What's the difference between .npmignore and .gitignore?

git, gitignore, npm, npmignore

Solution

`.gitignore` lists which files & folders should be omitted from any commits to the repository. You can use this repo for templates of files/folders to in your `.gitignore` depending on your environment.

`.npmignore` works similarly to `.gitignore`, it is used to specify which files should be omitted when publishing the package to NPM. You can read more about it in the `.npmignore` docs

Problem

What's the difference between `.npmignore` and `.gitignore`? What kind of files should I ignore in each?

Original source