Using eclipse egit plugin I\'ve encountered \"multiple merge bases\" exception. Before I\'ve managed to resolve the situation, but this time nothing helps. Even after crea
The recursive merge strategy needed for this is the default since EGit 3.0 (see bug 380314).
In case you are using an older version, see the download page for upgrading.
Alternatively, try resetting to your last local commit before you made the last merge, and then merge with origin/master
. Then if you made more changes on top of the original merge, cherry-pick these.
Another possibility would be to do the merge using C git (on the console), it can handle that situation.
If you can't or don't want to update to the latest EGit, then the most reliable work around is (as robinst suggests) to recover from this state and then merge on the command line.
Multiple merge bases
problem leaves your repository in the middle of a merge state.git merge -s ours
before doing a push.You can check to see if you are in a merge state by looking for MERGE_HEAD
and MERGE_MSG
files in your .git
folder. Just doing a git status
tells you nothing to commit
:
$ git status
# On branch master
# Your branch and 'origin/master' have diverged,
# and have 4 and 25 different commit(s) each, respectively.
#
nothing to commit (working directory clean)
$ cat .git/MERGE_HEAD
1234567890abcdef1234567890abcdef12345678
$ cat .git/MERGE_MSG
Merge remote branch 'origin/master'
You can then return to the state you were in before you attempted the merge from EGit.
$ git reset --hard
HEAD is now at 0123456 Blah blah blah
$ cat .git/MERGE_HEAD .git/MERGE_MSG
cat: .git/MERGE_HEAD: No such file or directory
cat: .git/MERGE_MSG: No such file or directory
As always, this will lose any and all changes made since the last commit.
Note that you could also do a git merge --abort
, but on some versions of git, this recommends that you commit your changes, which you should not do if you want to avoid your remote changed being silently reverted (which you definitely don't want).
You can now re-run the merge you originally wanted using the git command line, which will use the recursive resolve strategy and should thus work properly:
$ git merge origin/master
Auto-merging ...
...
Merge made by recursive.
...
$ git --no-pager log -1 --oneline
2345678 Merge remote branch 'origin/master'