I'm a newbie Node.JS developer...
What do developers usually exclude from their Node.JS git repositories in production via .gitignore?
node_modules? bin? Etc...
gitignore should contain all files that you want to ignore. Therefore, you should ignore files generated by the OS, the IDE you are working on... My question appears when the repository is on Github and people can clone it and push the changes. These people can use other operating systems and can use other IDEs.
gitignore is a plain text file in which each line contains a pattern for files or directories to ignore. It uses globbing patterns to match filenames with wildcard characters. If you have files or directories containing a wildcard pattern, you can use a single backslash ( \ ) to escape the character.
The . gitignore file tells Git which files to ignore when committing your project to the GitHub repository. gitignore is located in the root directory of your repo.
gitignore ignores only untracked files. Your files are marked as modified - meaning they were committed in the past, and git now tracks them. To ignore them, you first need to delete them, git rm them, commit and then ignore them.
GitHub has created a repository to answer this kind of questions for several languages/frameworks, including one for NodeJS.
https://github.com/github/gitignore/blob/master/Node.gitignore
Here is the current one for reference :
lib-cov *.seed *.log *.csv *.dat *.out *.pid *.gz pids logs results build node_modules
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With