dev@local: ~/project — git
dev@local~/project$git pull
Updating a1b2c3d..d4e5f6g
error: untracked files overwritten by merge
Please commit your changes or stash them before you switch branches.
Aborting
Diagnostics Translation
Git aborted the merge because it would overwrite untracked files in your working directory.
waiting for resolution...
MediumVersion Control System

Reviewed for reference consistency: April 11, 2026

Data Loss Risk

HIGH RISK

Git stopped to prevent overriding unsaved work. Do not force commands without stashing or committing first.

What To Know

This points to local files that exist only on disk colliding with incoming tracked files, so Git stops before those unmanaged files disappear.

Where Did It Fail?

Working Tree
Your local files
add
Staging Index
Prepared changes
commit
Local Repo
Commit history
push/fetch
Remote Server
GitHub/GitLab
Git halted to protect the uncommitted files in your active working directory.

Commands That Trigger This

$git pull
Running when you have a local config file that someone else recently committed to the repository
$git checkout
Trying to a branch that tracks a file you just generated locally

Technical Background

01

Git prioritizes data safety above all else. Because untracked files are not stored in Git's history, they cannot be recovered if overwritten.

02

By aborting the merge, Git forces you to either track, rename, or delete the file manually before proceeding.

Underlying Causes

An incoming branch contains a file with the exact same name as an untracked file in your local directory
Generating a local build artifact that Git later started tracking on another branch
Moving or renaming files without staging them before merging

Frequently Asked Questions

Git is protecting a file that exists only on your disk and is not yet recoverable from repository history. That is why it stops before the merge writes a tracked file at the same path.

Related Git States