Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why do I sometimes see an "Entry 'filename' not uptodate. Cannot merge." after a 'git reset --hard' and a 'git pull'?

Tags:

Occasionally, when I do the following...

git reset --hard HEAD is now at 0123abde comment is here
git pull Updating 0123abde..456789fa

I get the error...

error: Entry 'filename' not uptodate. Cannot merge.

The only workaround I have found is to 'git reset --hard', delete the offending file(s) then do 'git pull'. That doesn't seem right to me. Shouldn't a hard reset remove any and all local changes thus allowing me to pull the latest without any merge issues? Am I using git wrong? :)

This is on a CI machine so any changes here are unwanted. I'm using git version 1.6.1.9.g97c34 on Windows Vista.

like image 284
James Bobowski Avatar asked May 18 '09 16:05

James Bobowski


People also ask

Which is true regarding git fails to start the merge?

Git can fail during the mergeThis occurs because you have committed changes that are in conflict with someone else's committed changes. Git will do its best to merge the files and will leave things for you to resolve manually in the files it lists.

Would be overwritten by merge Cannot merge?

The “Your local changes to the following files would be overwritten by merge” error occurs when you try to pull a remote repository to your local machine whose contents conflict with the contents of your local version of the repository. To fix this error, either stash your changes away for later or commit your changes.

How do you abort a merge?

How do I cancel a git merge? Use git-reset or git merge --abort to cancel a merge that had conflicts. Please note that all the changes will be reset, and this operation cannot be reverted, so make sure to commit or git-stash all your changes before you start a merge.


1 Answers

The easiest solution I have found to this problem is:

git add . git merge --abort 
like image 61
Christophe Moine Avatar answered Sep 16 '22 14:09

Christophe Moine