I have a local branch in a local Git repository that I synchronize with a remote copy. That local branch has no corresponding remote branch at this point in time.
I need to rebase that local branch regularly to the newest version of the master branch of the repository which I do using the following sequence of Git commands:
git checkout master
git pull
git checkout my_local_branch
git rebase master
Whenever I do this, Git emits the following error message when the rebase operation reaches commits that contain a certain file named whatever.txt
:
error: Your local changes to the following files would be overwritten by merge:
Repo/src/whatever.txt
Please commit your changes or stash them before you merge.
Aborting
When I check using git status
to see what is going on I don't see any local changes to that file at all. Because of this, I simply continue the rebase operation using git rebase --continue
.
This works, i.e. the rebase operation continues but it stops again at the next commit that contains changes to whatever.txt
. In that case I just execute git rebase --continue
again.
The end result of the rebase is exactly as I expect it to be after executing the mentioned steps. But it puzzles me why Git stops and complains about changes to whatever.txt
. For me, the error message doesn't make sense because I have no conflicting local changes. I'm just rebasing the existing commits on top of the latest master branch commit.
Some sanity checks done on whatever.txt
showed the following results:
- It is a UTF-8 (with BOM) encoded file that contains text. I cannot find any
NUL
characters when opening it in a HEX editor so Git should have no reason to see it as a binary file. - The
.gitattributes
file explicitly sets* text=auto
and*.txt text
Does anyone have an idea why Git would stop during rebasing as described above?