Before you start, write your ignore rules on .gitignore file.
- Commit all your changes, just to not lose while you try these steps
- Clear your repo
git rm -r --cached .
3. Add everything back
git add .
4. Commit back
git commit -m ".gitignore fix"
You are good now, you can push the changes to remote.
🤙🏼