Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git Rebase Repository contains unmerged paths

Tags:

git

egit

How do you fix a failed rebase with git?

I received a pull request on github for some relevatively minor changes to a single file, so I accepted and then in my local branch, fetched the changes and performed a rebase.

However, for some reason, git found conflicts, even though I had not modified the file since the contributor's modification. I used EGit to resolve the conflicts, which were trivially, but now I'm stuck. EGit lists my project as in "rebase interactive" mode and it's still showing the file as conflicting. If I try to do a "Rebase->Continue Rebase" I receive the error "Repository contains unmerged paths". How do I resolve this?

like image 308
Cerin Avatar asked Jul 15 '14 14:07

Cerin


2 Answers

The way to mark files as resolved (in both EGit and command line Git) is to add them to the index:

Open the context menu of the file > Team > Add to Index

After that, continuing the rebase should be possible.

like image 180
robinst Avatar answered Oct 26 '22 09:10

robinst


After Git starts the rebase operation you need to:

  1. Fix the issues in the conflicting files. They should be marked in red in the Project Explorer, and you can also see them in the Git Staging view under the Unstaged Changes heading. If you are missing either of these views, select the Eclipse menu option Window > Show View to show them.
  2. In the Git Staging view, click and drag the fixed files from Unstaged Changes to Staged Changes. If you don't do this step you get the "contains unmerged paths" error.
  3. In the Git Repositories view, right-click on your repository and select Rebase > Continue.

Hopefully the merge succeeds at this point!

For the case where Git thought there were conflicts but there weren't really any, in step (2) when you drag the files to Staged Changes they will disappear. In step (3) you will need to select Rebase > Skip.

Good luck.

like image 40
Jonathan Benn Avatar answered Oct 26 '22 10:10

Jonathan Benn