Git allows for a special .gitignore file that allows us to specify which files Git should ignore. So, create a .gitignore file at the project root directory, and add the following lines:
node_modules/dist/
Now, when we run git status again, node_modules/ and dist/ are gone from our list, and .gitignore is added:
$ git statusUntracked files: .babelrc .eslintrc.json .gitignore .nvmrc package.json src/ yarn.lock
Apart from the node_modules/ and dist/ directories, there will be many other files we'll eventually want Git to ignore; for example, a yarn-error.log is generated whenever yarn encounters an error. It is for our information only and should not be tracked on Git. While we can keep adding more and more ...