How to Include and Exclude files using .gitignore file ?
Why gitignore not working ?
Ignore files and folders using .gitignore
Example 1. Ignore (Exclude) a simple file or a folder
Example 2. Include a file / folder
Example 2. Include a file located in a Excluded folder
Step 1. Include the 'Excluded' folder
Step 2. Exclude All files and folders in this folder
Step 3. Re Include the specific file or folder
Git Cache : gitignore not working
If files are already cached, .gitignore may not working
CAUTION !!! Do not forget to commit your changes before all this operations
1. Rebuild all cache
git rm -r --cached .
git add .
git commit -m "clear all cache to fix file tracking"
2. Remove cache of a folder already added to the git
git rm -r --cached thefile.txt thefolder
3 Remove cache of a file already added to the git
git rm --cached sites/default/settings.php