TL;DR: Your git pull is failing because of a "phantom" local change that git status might not even show you. git pull --force won't help. The master key to escape is:

  1. Discard local changes & fix the index: git reset --hard HEAD
  2. Then, pull safely: git pull

It started, as all developer nightmares do, with a "5-minute task." I was a few commits behind origin. I had a local change I didn't care about. I just wanted to sync up.

I ran the obvious command:

git pull

And Git, in its infinite wisdom, screamed at me.

💥 error: Your local changes to config.yml would be overwritten by merge.

"Fine," I grumbled, "I don't need those changes." I reached for the bigger hammer. The one we all think is the ultimate override.

git pull --force

...and was met with the exact same error. I was trapped. I couldn't pull, I couldn't check out, and my simple task had just spiraled into a debugging nightmare. This is the story of my escape.

🤔 Investigation, Act I: The Great -force Illusion

The first lesson from Git Hell is that git pull --force is a myth. It does not mean "force the merge."

git pull = git fetch + git merge. The --force flag only applies to fetch.

Analogy: Imagine a meticulous librarian (git merge) trying to add new pages to your book.

👎 What you think it does: Overwrite my local files with whatever is on the remote.