So you have added a new file to
.gitignore or you have just added a new .
gitignore file to your existing repo. The problem is same you don’t want git to rack one or many files. This can be archived in simple 3 step process. Assuming that you have already added or updated
.gitignore file you need to do following steps
- Remove all files from index i.e clear cache
- Add all files using add command. This time due to .gitignore only relevent files will be added
//remove every thing from index git rm -r --cached . //add everything respecting the new/updated .gitignore git add . //Commit git commit -m "We have updated .gitignore or added it"
Hope this helps !!!