what is .gitignore code example

Example 1: reinit gitignore

# rm all files
git rm -r --cached .
# add all files as per new .gitignore
git add .
# now, commit for new .gitignore to apply
git commit -m ".gitignore is now working"

Example 2: gitignore

Use the service www.gitignore.io to create your personalized .gitignore

Example 3: .gitignore

node_modules
.DS_Store
.env

Example 4: what to add to gitignore

Look at this awesome site!
https://www.toptal.com/developers/gitignore
Generates a gitignore for you, based on the technologies you're using

Example 5: git exclude folder

directory_to_exclude/

Example 6: how to git ignore a file

git config --global core.excludesfile ~/.gitignore_global