I'm attempting to fast forward my branch by four commits made by someone else. However, Git keeps giving me this error:
error: Your local changes to the following files would be overwritten by merge:
path/to/file/A
path/to/file/B
etc.
Please commit your changes or stash them before you merge.
Aborting
As per How do I ignore an error on 'git pull' about my local changes would be overwritten by merge? I tried git stash push --include-untracked
followed by git stash drop
, but that just resulted in the same error.
Following the directions in the answer to Git showing identical files as changed, I tried rm .git/index; git reset
and this did shorten the list of files that Git showed as changed, but there were still some there. git reset --hard
restored the list of "changed" files to its original size.
I've also tried removing .gitattributes (which has a text=auto
line in it) but the files are still shown as changed. Their line endings are all LF anyway, so I doubt a line ending setting would affect these.
In a moment of desperation, I tried git rm -r -f .
, which deleted everything but the .git
directory, but upon trying to pull I still get the error about these files having changes that will be overwritten, even when the files are deleted. Of course when I do git reset; git status
I have all of the files restored and the same set of files is shown as being changed.
I could just delete the whole repository and re-clone it, but I'd like to figure out what's going on. What is causing this behavior?