Git and saving your work
Stop committing files that shouldn’t be in Git
The .env file, node_modules or build output ended up in the repository.
- What you get
- A correct .gitignore, the wrong files no longer tracked, and any exposed secrets flagged.
- Paste it into
- Your AI tool, in your project
The prompt
Check what this repository is tracking that it shouldn't. Look for: environment files with real values, dependency folders, build output, editor and system files, logs, database files, and large media. Show me what you find and how much of the repository's size it accounts for. Fix the .gitignore for this stack and stop tracking those files without deleting them from my disk. If any file with secrets was ever committed, list each secret by name only and tell me it needs replacing, because removing the file now doesn't remove it from history. Make sure an example environment file with placeholder values is tracked instead.
Use it
Open your AI tool (Claude Code, Codex or Cursor) in your project folder and paste it in.
More in Git and saving your work
Stop building straight on the live site
Every change goes to main and straight to production, tested by your users.
Save versions you can find your way back to
One giant commit called “update” holds a week of work.
Get out of a Git mess without losing work
Conflicts, a detached HEAD or a rejected push, and every suggested command looks dangerous.
Go back to the last version that worked
The last hour of changes made things worse and you want it gone.