How to write .gitignore file

What is .gitignore?

GitIgnore file is a file that specifying the files or folders that we want to ignore.

You have to create one file with name .gitignore.

How to ignore?

To ignore file just put the file name in the .gitignore file.

# file names
demo1.txt
demo2.txt
 .
 .
 .
demo3.txt

# ignore files with extensions

*.java

suppose we don’t need the folders called node_modules and dist

# folders

node_modules/
dist/

Save the file and put the file in the root project folder.