The .gitignore
is a plain-text file. It allows you to specify files and folders
that you’d like to exclude from your git
commits. .gitignore
should be placed in the
root directory of your git
project.
You can add files to .gitignore
by adding their names to it.
local.env
Here, I’ve excluded the file local.env
from being added to the next git
commit.
To add more entries to .gitignore
, use new lines.
local.env
reminder.txt
If you specify the directory (folder) name, all it’s files and subdirectories will be excluded.
local.env
reminder.txt
node_modules
public
To exclude a file that’s located in the internal directory, you should specify its path
relative to the location of .gitignore
.
local.env
reminder.txt
node_modules
public
src/routes/localHelper.js
One of the most common folders to ignore in modern JavaScript projects in the node_modules
directory.