I'm trying to update my repo from a remote branch and keep getting this error when I do a "git pull". I haven't made any local changes, and even if I have I don't need to keep them.
I've tried:
git reset --hard
and I get the same problem
The only thing that seems to work is deleting the offending file and try a git pull again.
I've also tried git stash
followed by a git pull
. No go.
edit: using PortableGit-1.6.4-preview20090729 so any previous bugs with spurious errors should be fixed.
This may happen if you update the index to ignore certain files:
git update-index --assume-unchanged <file>
and then for instance checkout some other branch:
git checkout <branch>
> error: Entry '<file>' not uptodate. Cannot merge.
Forcing index refresh fixes the issue:
git update-index --really-refresh
<file>: needs update
Followed by:
git reset --hard
And then everything should be back to normal.
There's a couple of ways to fix this but I've found git stash works good for me. It temporary puts your local changes into another place. Then you can pull, to grab the latest changes. And then you can get your local changes back.
Just like this:
$ git pull
...
...
file your_file.rb not up to date, cannot merge.
$ git stash
$ git pull
$ git stash pop
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With