Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git refusing to merge because of changes to an unchanged file

I'm having a git problem where I want to merge a branch into master but it's refusing to merge because it thinks I have local changes to a file. Doing status shows no changes and diffing the files produces nothing. Here's the terminal output:

$ git checkout ProductsAndContents
Switched to branch 'ProductsAndContents'

$ git status
# On branch ProductsAndContents
nothing to commit (working directory clean)

$ git checkout master
Switched to branch 'master'

$ git status
# On branch master
nothing to commit (working directory clean)

$ git merge ProductsAndContents
error: Your local changes to the following files would be overwritten by merge:
    tests/unit/src/models/BrandTests.js
Please, commit your changes or stash them before you can merge.
Aborting

Any help or suggestions would be most appreciated!

like image 491
Mark Stickley Avatar asked Mar 01 '13 18:03

Mark Stickley


2 Answers

Thanks to Andrew Myers' comment on my initial question, I discovered setting core.trustctime to false solved the problem.

git config core.trustctime false

Something about mismatching inode change times. I'm guessing this is because the repo is sitting on a fileshare on a machine with a different file system from the one I'm using.

Thanks for all the suggestions!

like image 181
Mark Stickley Avatar answered Nov 11 '22 14:11

Mark Stickley


Well, if you're confident you won't loose any work, try the following:

rm tests/unit/src/models/BrandTests.js
git checkout -- tests/unit/src/models/BrandTests.js

That should reset any mechanism that made it think it had changes. If it doesn't work, have others that might.

like image 38
Trevor Norris Avatar answered Nov 11 '22 16:11

Trevor Norris