ProjectStack
git

error: The following untracked working tree files would be overwritten

Git is stopping you from checking out or merging because the incoming branch has files that also exist as untracked files in your working directory. Proceeding would silently overwrite them.

Common causes

  • You created files locally that aren't tracked by Git but exist in the target branch
  • You ran git clean to remove tracked files but the untracked replacements remain
  • A previously generated artifact shares a name with a tracked file in the other branch
  • Files were moved to .gitignore but still exist on disk

How to fix it

  1. Check what untracked files are present: git status
  2. Remove the conflicting untracked files if they're safe to delete: rm <filename>
  3. Or move them somewhere else temporarily before switching branches
  4. To force-overwrite (will lose the local untracked files): git checkout -f <branch>

Example

error: The following untracked working tree files would be overwritten by checkout: dist/bundle.js Please move or remove them before you switch branches.

Switching to a branch that includes a file you also have as an untracked local file

Have a different error?

Paste any error message into the Error Translator to get an instant explanation.