PlainError

error: Your local changes to the following files would be overwritten by merge: Please commit your changes or stash them

Last checked 2026-11-09 · 3 fixes · reviewed answer

TL;DRThis Git error occurs when you try to merge or pull new code from a shared repository but your local project has uncommitted edits that would be replaced or lost. Git (a tool for tracking code changes) halts to avoid overwriting your work. The message lists the specific files involved.

Most likely cause: Uncommitted local edits exist in one or more files while attempting a merge or pull

Try first: Check current status (git status)

Likely causes

  1. Uncommitted local edits exist in one or more files while attempting a merge or pullmost likely
  2. Stash or commit was skipped before running the merge commandpossible

How to fix it

Safest first: SafeChanges settingsDangerous
  1. Check current statusSafe

    Run this read-only command to see exactly which files have changes and confirm the situation.

    git status
  2. Commit your changesChanges settings

    Save your local edits as a new commit so they are preserved before merging.

    git add . && git commit -m "save local changes"
  3. Stash changes temporarilyChanges settings

    Hide your edits in a temporary storage so the merge can proceed; you can restore them later.

    git stash

If that didn't fix it

Run git status again after trying the steps to list any remaining conflicting files and decide whether to commit or discard them

When to see a technician

If you are working in a team repository and are unsure which changes to keep, ask a colleague familiar with the project for help.

Quick answers

What does error: Your local changes to the following files would be overwritten by merge: Please commit your changes or stash them mean?
This Git error occurs when you try to merge or pull new code from a shared repository but your local project has uncommitted edits that would be replaced or lost. Git (a tool for tracking code changes) halts to avoid overwriting your work. The message lists the specific files involved.
What causes error: Your local changes to the following files would be overwritten by merge: Please commit your changes or stash them?
Uncommitted local edits exist in one or more files while attempting a merge or pull. (most likely) Stash or commit was skipped before running the merge command. (possible)
How do I fix error: Your local changes to the following files would be overwritten by merge: Please commit your changes or stash them?
Try these in order, safest first: 1. Check current status. 2. Commit your changes. 3. Stash changes temporarily.
What if that didn't fix it?
Run git status again after trying the steps to list any remaining conflicting files and decide whether to commit or discard them
When should I see a technician?
If you are working in a team repository and are unsure which changes to keep, ask a colleague familiar with the project for help.
Did this fix it? Report a problem

Related errors

All Coding errors →