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

The easiest solution I have found to this problem is:

git add .
git merge --abort

I was having the same issue and I renamed the file which was causing this and did a git pull. It pulled that missing file and fixed the issue.


The general idea behind "Entry 'filename' not uptodate. Cannot merge." is:

You have changes to files in your working directory that will be overwritten, removed or otherwise lost if the checkout and change to the new branch were to proceed.

It has been reported that this message could be "spurious" at time, (potentially because "git pull" did not refresh the index before trying to merge) but the fix was in Git1.6.1.
However, it may still be in mSysGit 1.6.1, so do you see the same error with a more recent mSysGit version ? (like 1.6.3)


Before Git 2.30.1 (Q1 2021), "git stash"(man) did not work well in a sparsely checked out working tree.

See commit ba359fd, commit b34ab4a, commit a31e48d (01 Dec 2020) by Elijah Newren (newren).
(Merged by Junio C Hamano -- gitster -- in commit 62fb47a, 15 Jan 2021)

t7012: add a testcase demonstrating stash apply bugs in sparse checkouts

Signed-off-by: Elijah Newren

Applying stashes in sparse-checkouts, particularly when the patterns used to define the sparseness have changed between when the stash was created and when it is applied, has a number of bugs.

The primary problem is that stashes are sometimes only partially applied.

In most such cases, it does so silently without any warning or error being displayed and with 0 exit status.

There are, however, a few cases when non-translated error messages are shown and the stash application aborts early.

The first is when there are files present despite the SKIP_WORKTREE bit being set, in which case the error message shown is:

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

The other situation is when a stash contains new files to add to the working tree; in this case, the code aborts early but still has the stash partially applied, and shows the following error message:

error: NEWFILE: does not exist and --remove not passed
fatal: Unable to process path NEWFILE