ProjectStack
git

error: Your local changes to the following files would be overwritten by merge

Git is stopping you from merging or pulling because the incoming changes conflict with uncommitted local changes in your working directory. Git won't proceed to avoid data loss.

Common causes

  • You edited files locally but didn't commit or stash before pulling
  • The same files were changed on the remote and locally
  • You're trying to switch branches or merge with a dirty working tree
  • An automated pull ran while you had unsaved work

How to fix it

  1. Commit your local changes first: git add . && git commit -m 'WIP'
  2. Or stash them temporarily: git stash, then git pull, then git stash pop
  3. To discard local changes entirely (data loss): git checkout -- <file>
  4. Review what's modified before deciding: git status && git diff

Example

error: Your local changes to the following files would be overwritten by merge: src/App.js Please commit your changes or stash them before you merge.

Running git pull with uncommitted changes to files that the remote also modified

Have a different error?

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