gitignore up a directory 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: create .gitignore
$ touch .gitignore
Example 3: gitignore a specific file
$ echo debug.log >> .gitignore $ git rm --cached debug.log rm 'debug.log' $ git commit -m "Start ignoring debug.log"