Keep junk files out of your repo using .gitignore and clean untracked clutter.
- Create a .gitignore
- echo “node_modules/” >> .gitignore
- echo “*.log” >> .gitignore
- git rm -r —cached .
- git add .gitignore && git commit -m “Add .gitignore”
- Global ignores
- git config —global core.excludesFile ~/.gitignore_global
- echo ”.DS_Store” >> ~/.gitignore_global
- Cleaning untracked files (dry-run first!)
- git clean -nd # preview files to be removed
- git clean -fd # remove untracked files and dirs
Checklist
- Project .gitignore configured
- Global ignores for OS/editor files
- You can preview and run git clean safely