Remove Accidental Commit(s)
Removing accidental commits
Example code:
git rm -r --cached node_modules/
git rm -r --cached .astro
# More examples
git rm -r --cached <folder>/
git rm --cached <file>
git rm --cached "*.<ext>"
git rm -r --cached .
# Commit the changes
git add .gitignore
git commit -m "chore: remove node_modules and .astro from tracking"
git push
.gitignore (to prevent the same thing from happening in the future):
# Ignores ONLY folders named "dist"
dist/
# Ignores specific files
.env
secret-keys.txt
# Ignores ANY file ending in .log
*.log