The Gitignore file
If you don’t want to commit a file into a Git repository, it makes sense not to have the file show up in the staging area.
You can do this with a Gitignore file.
In the video, we installed a library called Typi with npm. Many files come into our staging area when we installed Typi.
node_modules and its files from appearing in the staging area, you:
- Create a
.gitignorefile at the root of the project
node_modulesin the Gitignore file
And the staging area becomes clean. AT this point, you want to commit your
.gitignore file to preserve what to ignore.
How to use Gitignore
Each line in the Gitignore file can be used to match files and folders you don’t want to see in the staging area.
- To ignore a file, you write the file name.
- To ignore a folder, you write the folder name
- To ignore an extension, you can use a
Thanks for reading. Did this article help you out? If it did, I hope you consider sharing it. You might help someone else out. Thanks so much!