.gitignore does nothing for tracked files. If VS Code 550 settings slipped into a commit, git rm --cached drops them from the index, and so from the next commit, but not from disk:
mkdir .vscode && printf '{ "editor.fontSize": 15 }\n' > .vscode/settings.json
git add .vscode && git commit -qm "Add VS Code settings"
git rm -r --cached .vscode
echo '.vscode/' >> .gitignore
git add .gitignore
git commit -m "Stop tracking personal editor settings"
git status --short --ignoredrm '.vscode/settings.json' [main 9004c2c] Stop tracking personal editor settings 2 files changed, 1 insertion(+), 1 deletion(-) delete mode 100644 .vscode/settings.json !! .env !! .vscode/ !! node_modules/
!! marks ignored paths. The old version stays in history, so a leaked password must be changed, not just untracked. For a tracked file you edit only locally, such as a port in docker-compose.yml, git update-index --skip-worktree <file> hides your changes (--no-skip-worktree undoes it).
git clean deletes untracked clutter permanently, so preview with -n first:
mkdir tmp && touch tmp/scratch.sql notes.txt
git clean -nd
git clean -ndX
git clean -fdWould remove notes.txt Would remove tmp/ Would remove .env Would remove .vscode/ Would remove node_modules/ Removing notes.txt Removing tmp/
-d includes directories, -f is required to delete, -x adds ignored files and -X removes only ignored ones; the -ndX preview shows it would take your .env, editor settings and node_modules. BookNest now has six commits, ready for branching in Branching and Merging.