Fix · GitHub and Git
"Your local changes would be overwritten" when pulling or switching
What you may see
- Pull or switch branch is blocked because I have unsaved edits
- Git tells me to commit or stash
Most likely cause
You have edits that are not saved as a commit, and the incoming change touches the same files.
Check first (about two minutes)
- Run git status to see which files have edits.
The fix prompt
What you type here never leaves your browser. The search runs on this page, and nothing is sent to a server or to an AI.
Kept only in this browser, on this device. Keys and passwords are removed before anything is saved.
Prompt language
Paste it into Claude, ChatGPT, Gemini or Cursor, then follow what it says.
After you tried it, did it work?
Steps
- Run git status and git diff --stat and show me.
- Save my edits safely: either git add -A and git commit -m "work in progress", or git stash push -m "before pull". Ask me which I prefer.
- Do the pull or the branch switch.
- If I used stash, bring the edits back with git stash pop and help with any conflict.
Do not do this
- Do not delete files by hand to silence the message.
- Do not run git checkout -- . or git reset --hard (they erase my edits).