add a git ignore file code example

Example 1: gitignroe remove folder

git rm -r --cached some-directory
git commit -m 'Remove the now ignored directory "some-directory"'
git push origin master

Example 2: git add gitignore

$ touch .gitignore

Example 3: 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 4: how to git ignore a file

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

Example 5: git ignore content of a folder

# exclude everything
somefolder/*

# exception to the rule
!somefolder/.gitkeep

Example 6: how to add filer to git ignore

go to the gitignore file, add the name of the file to ignore