Bogus Git error message... can't fix or work around it

54 Views Asked by At

Something has happened to my local copy of a Git repo. When I try to synch it to the server (git pull) I get the following message.

Updating 060b8f7..af17d97
error: Your local changes to the following files would be overwritten by merge:
        docs/user-guide/images/Databricks/initscript.png
        docs/user-guide/images/Databricks/initscript_ucx.png
Please commit your changes or stash them before you merge.
Aborting

Now, I have never changed those two files. In fact before I got the error I had never visited a directory farther down that path than user-guide. Furthermore this is happening in branch main, and I would never change anything there; I never even check it out except to go a git pull or create a new working branch.

I tried stashing the changes as the error suggests. git stash gave me this:

Saved working directory and index state WIP on main: 060b8f7 Merge branch 'js-23c06-Incorrect-brackets-in-Qualification-tool-docs' into 'main'
Encountered 2 files that should have been pointers, but weren't:
        docs/user-guide/images/Databricks/initscript.png
        docs/user-guide/images/Databricks/initscript_ucx.png

Then I tried to pull, and I got the same "local changes would be overwritten" error. I also tried a hard reset and git restore <filename>. None of that affected the error.

I consulted the engineers I'm working with, and we agreed that I should save my changed files, delete and re-clone the repo, and reapply my changes. But to save my changed files I have to check out the branches they're in, and when I try to do that, Git gives me the "local changes would be overwritten" error again.

So there seems to be no way to restore the repo to usability without abandoning whatever work I've done in any branch.

Can anyone help?

0

There are 0 best solutions below