I had uploaded all my source files to bitbucket and after that I changed my .gitignore file in git. When I cloned the repository and changed my files my git status not ignoring the folders specified in the .gitignore file.
git status --ignored
When I run the above command it is not showing the ignored folders. After a ton of search I found that git rm -r --cached . can clear local git cache and after that when i check status all my ignored folders are showing now. But the problem is after a I push my changes to repository the files and folders specified in the gitignore file is getting removed from repository. Is there any way i can prevent files from removing from repository.