ignore file git code example
Example 1: git add -A ignore large files
find . -size +1G | cat >> .gitignore
# Remember to run it each time you want to update the gitignore!
Example 2: How to ignore files in git
Then in Git Bash you have to write the following line:
git config --global core.excludesfile ~/.gitignore_global
--------------------------------------------------------------------
If the repository already exists then you have to do the following:
git rm -r --cached .
git add .
git commit -m ".gitignore is now working"
If the step 2 doesn’t work then you should write the whole route of the files that you would like to add.
Example 3: git exclude folder
directory_to_exclude/
Example 4: how to git ignore a file
git config --global core.excludesfile ~/.gitignore_global
Example 5: git ignore not saving changes
git rm -rf --cached .
git add .
Example 6: gitignore a specific file
$ echo debug.log >> .gitignore $ git rm --cached debug.log rm 'debug.log' $ git commit -m "Start ignoring debug.log"