Can't checkout because of unmerged files

I was trying to merge a branch into another when something failed at conflict resolution and the window that displays files with conflicts disappeared before I was done resolving everything. I couldn't see what conflicts are pending, and I can't see them anymore.

I tried reverting the branch using the "Revert" tool but the branch is now in a "Merging branch-name" state that blocks me whenever I try doing anything like pull, push, commit or change branches.

When I try switching branches I am getting this message in the Event Log:

 

Can't checkout because of unmerged files
You have to resolve all merge conflicts before checkout.
After resolving conflicts you also probably would want to commit your files to the current branch.

 

The word "resolve" is underlined but when clicking it nothing happens. I would expect the "resolve conflict" window to pop up but it just doesn't.

How can I solve this huge problem? I would just like to restore the state of the branch before the merge and try merging again from a clean slate.

3 comments
Comment actions Permalink

Unfortunately, I do not know how to make the merge tool to re-appear. I hope somebody will chirp in on that. Would love to learn myself.

But to get you unstuck ...

Option 1:

Open a terminal window and go to the project directory. Execute "git status" in the terminal. The output will show you the list of files yet to be merged. If the list is short and merge is trivial, try to merge it yourself. Read this page https://git-scm.com/docs/git-merge#_how_conflicts_are_presented for more information.

 

Option 2:

Following are the steps required to restart the merge, losing everything you've merged till this point.

Not sure what version control system you are using, is it git? If the answer is yes:

  • open a terminal window and go to the project directory (PyCharm built-in terminal will open in your current project)
  • execute "git reset HEAD --hard". This will revert your working tree to the latest commit before you started the merge.
  • start merge again

 

3
Comment actions Permalink

I just had the same problem with Rider 2019.2.2. A file was renamed in Branch A and moved in Branch B. Although I am pretty sure I solved all problems in the conflicts list, I could not commit my changes. To solve the problem I had to 'git rm' the file on the command line.

0
Comment actions Permalink

Sometimes this happens if both sides have deleted the same file. You need to recreate the file locally and then select git->resolve conflicts, the resolve conflicts choice will work again and then you can resolve the conflict. Not ideal if it's many files, but useful if it's just one.

0

Please sign in to leave a comment.