Skip to content

Error: Pulling is not possible because you have unmerged the files: 2 Fixes

  • by
  • 2 min read

Git is a great way to manage versions of your program and work collaboratively over a piece of code. However, it isn’t always as easy as just pushing code to a remote repository.

In this article, we’re talking about the “Error: Pulling is not possible because you have unmerged files” issue and giving you two fixes on how to get rid of the problem. 


Why does this happen?

As you can probably guess from the error message itself, the error is caused due to unresolved files in your local repository. You may have a certain set of files you tried merging with the repository earlier, but they threw a merge conflict and then someone else overwrote your merge with their own push. 

This creates a version separation between the files on your local drive and the files in the Git repository, causing this error. 

Also read: TSDZ2 st-link error: Cannot communicate with the tool: 4 Fixes


How to fix this?

Here are two fixes you can try out.

Sync the repositories

The easiest way to resolve this error is the pull the repository and sync it with your local files. That way, when you push your code again, you’ll have no version disparity to worry about. You can pull code using the following command.

git pull

Reset your local repository

If you don’t want to merge the changes made in the remote repository with your local one, but you still need to update the local repository, use this command.

git reset --hard HEAD

The command mentioned above will reset your local repository with HEAD and pull any changes from the remote using git pull hence resolving the error. Additionally, use this command if you’ve already committed your merge locally and want to revert the change. 

git reset --hard HEAD~1

Also read: How to fix ‘GPG failed to sign the data’ error?

>