overwritten by checkout 🌿 Git

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

Switching branches would discard uncommitted changes in files that differ between branches.

Seen on: Git

Meaning

Commit, stash or discard first. git switch refuses for the same reason.

Common causes

  • Uncommitted changes to files that differ on the target branch
  • Generated/build files that are tracked in git

⚡ Quick fix

  1. Commit or stash: git stash && git switch other && git stash pop
  2. Or carry changes with git switch --merge (careful)

Detailed fix by platform

Git

  1. git stash push -m "wip" && git switch release && git stash pop

How to diagnose

  1. Files — Which ones are listed?
  2. Recent change — Did it start after a deploy, upgrade, or configuration change? Compare with the last working version.

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.