Can't checkout because of unmerged files Follow
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.
Please sign in to leave a comment.
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 ...
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.
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:
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.
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.
For me it didn't know how to compare unmerged files. Some have been moved and renamed so Intellij could not guess. Eventually I looked at a few files one by one and realized what happened and then, after all the synchronization, I've pushed the changes and my branch returned to normal. So maybe look out for extreme changes.
Here is what worked for me:
On the navigation tab, look for Git, which is beside Tools
Click on Git, you'll see an option to "Abort Merge", click on that
There you have it, your branch is back to its original state before you started the merge process which involved resolving conflicts