untracked files overwritten 🌿 Git

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

  1. Move or delete the listed files, then retry
  2. Clean untracked files carefully: git clean -n (preview) then git clean -f
  3. Add generated files to .gitignore

Detailed fix by platform

Git

  1. bash
    git clean -n -d   # preview
    git clean -f -d   # remove

How to diagnose

  1. Files — Which paths?
  2. 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.