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 stagi…


This content originally appeared on Zell Liew and was authored by Zell Liew

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 files in staging area

To prevent node_modules and its files from appearing in the staging area, you:

  1. Create a .gitignore file at the root of the project
  2. Add node_modules in the Gitignore file

And the staging area becomes clean. AT this point, you want to commit your .gitignore file to preserve what to ignore.

Node modules removed from staging area

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.

  1. To ignore a file, you write the file name.
  2. To ignore a folder, you write the folder name
  3. To ignore an extension, you can use a * wildcard, like *.log


This content originally appeared on Zell Liew and was authored by Zell Liew


Print Share Comment Cite Upload Translate Updates
APA

Zell Liew | Sciencx (2018-12-07T00:00:00+00:00) The Gitignore file. Retrieved from https://www.scien.cx/2018/12/07/the-gitignore-file/

MLA
" » The Gitignore file." Zell Liew | Sciencx - Friday December 7, 2018, https://www.scien.cx/2018/12/07/the-gitignore-file/
HARVARD
Zell Liew | Sciencx Friday December 7, 2018 » The Gitignore file., viewed ,<https://www.scien.cx/2018/12/07/the-gitignore-file/>
VANCOUVER
Zell Liew | Sciencx - » The Gitignore file. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2018/12/07/the-gitignore-file/
CHICAGO
" » The Gitignore file." Zell Liew | Sciencx - Accessed . https://www.scien.cx/2018/12/07/the-gitignore-file/
IEEE
" » The Gitignore file." Zell Liew | Sciencx [Online]. Available: https://www.scien.cx/2018/12/07/the-gitignore-file/. [Accessed: ]
rf:citation
» The Gitignore file | Zell Liew | Sciencx | https://www.scien.cx/2018/12/07/the-gitignore-file/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.