Welcome to the CSC Q&A, on our server named in honor of Ada Lovelace. Write great code! Get help and give help!
It is our choices... that show what we truly are, far more than our abilities.


+12 votes

Hello, I am not really familiar with gitignore file, but I want to ignore the file .env in the subdirectory (not the root). Is there a to do that?

asked in CSC490_Spring202021 by (1 point)

gitignore is a text file that has not been staged or committed. If you want to stop the tracking all you have to do is add the file in your .gitignore. and run git rm --cached in your terminal.

1 Answer

+5 votes
Best answer

A git ignore file is just a text file that follows traditional bash file structure.

So if you wanted to ignore the entire current folder you'd type:./
./ means current directory

Also if you type *.jpeg you would ignore any file with the extension .jpeg at the end of it

So if you want to exclude a folder name you'd type a like that looks like this ./<folder name>/a common folder that is excluded is node_modules, because it stores local packages that clutter your workspace, so you'd type ./node_modules/ in your gitignore file.

answered by (1 point)
selected by