Search code examples
gitgithubmergegit-svnrebase

git rebase fails with Unknown exit code (128) from command: git-merge-recursive


Consider the following scenario: - upstream repository with 2500 is stored in SVN - git user A imports the repository into git and commits 1 patch - git user B imports the repository into git and commits 1 patch - git user A wants to merge the patch from git user B

In this case, if user A uses git merge, then the git history will be polluted with the common svn commits (i.e. instead of 2502 commits, history will contain 2501+2501 = 5002 commits!)

If user A uses git rebase, then git history will be correct (2502 commits). This works fine in this simple scenario, but if user A and user B had not 1 but 1000 commits each then a strange complication arises: git rebase -Xours fails with the following message:

First, rewinding head to replay your work on top of it...
fatal: Could not parse object '98d7cd83de321e737b22240752cd178622d29406^'
Unknown exit code (128) from command: git-merge-recursive 98d7cd83de321e737b22240752cd178622d29406^ -- HEAD 98d7cd83de321e737b22240752cd178622d29406

You can e.g. reproduce this issue using the following github repositories:

git clone https://github.com/opentk/opentk
cd opentk
git remote add mono https://github.com/mono/opentk
git fetch mono
git checkout -b integrate
git rebase -Xours mono/rodo-consolidate-opentk

Does anyone know why this happens? Any ideas how to resolve this issue?


Solution

  • I had a similar issue with this error and I gave up rebase, and instead used cherry-pick to pick the changes, and it worked fine.