error: The following untracked working tree files would be overwritten by checkout/merge
Untracked local files have the same paths as files coming from the other branch.
Seen on:
Git
Meaning
Git won’t overwrite untracked files. Often generated files (node_modules, build output) or files that were added to the repo upstream.
Common causes
- Generated files existing locally that are now tracked upstream
- Files created manually with the same names
- Case-only renames on case-insensitive filesystems
⚡ Quick fix
- Move or delete the listed files, then retry
- Clean untracked files carefully: git clean -n (preview) then git clean -f
- Add generated files to .gitignore
Detailed fix by platform
Git
- bash
git clean -n -d # preview git clean -f -d # remove
How to diagnose
- Files — Which paths?
- Keep — Do you need them?
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
Was this page helpful?
Report a correction or suggest an improvement
Last updated 2 Oct 2026