Error Fix

How to Fix 'Untracked Files Would Be Overwritten' in Git

What the error means and how to protect local files before switching branches or pulling.

Git raises this error when an operation would replace local untracked files with tracked files from another commit or branch. It is a safety stop, not a bug.

Best Fixes

Move, remove, or commit the local files before retrying the branch change or pull.

If the files matter, stash or back them up first so you do not lose local work.

Avoid This

Do not delete the files casually if you are not sure whether they contain important local changes.

Do not use aggressive cleanup commands until you understand exactly what is untracked.

Save commands, add notes, and build a Cheatbook with the fixes you want to keep handy.