Instruction

Ignore Files and Directories with gitignore

Use a .gitignore file to instruct your version control system to ignore or avoid tracking specified files or directories when you make a commit.

In your project, create a file named .gitignore in the root directory. Inside this file, you list the name of files and directories that you don’t want to include in your GitHub repo. In this case, it’s node_modules/.

A .gitignore file listing the node_modules directory

Note: The path node_modules/ will match a directory named 'node_modules' and any paths underneath it.

All project files should be present when you commit and push your latest code to GitHub except for the node_modules directory and files.

Remember: the .gitignore file must be created and list any files or folders you want to ignore before pushing to GitHub.

In the following video, you’ll practice updating, uninstalling, and executing packages.

Further Reading