Git rebase terminates with an unknown exit code (128) from the command: git -merge-recursive

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

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

If user A uses git rebasethen git history will be correct (2502 commits). This works fine in this simple scenario, but if user A and user B do not have 1, but 1000 commits each, a strange complication arises: git rebase -Xoursit crashes 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, for example, reproduce this problem 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 is happening? Any ideas how to solve this problem?

+3
source share
4 answers

I had a similar problem with this error, and I refused rebase, and instead used cherry-pickto select the changes, and it worked fine.

+1
source

, , . , , , , (, ).

git, . svn-, , .

, , = = renormalize, , . , , ( "" , ).

:

  • git rebase <branch> --strategy=recursive --strategy-option=ours
First, rewinding head to replay your work on top of it...
fatal: Could not parse object '67fceed5a80ff78ac6f9a437620323131c88cd51^'
Unknown exit code (128) from command: git-merge-recursive 67fceed5a80ff78ac6f9a437620323131c88cd51^ -- HEAD 67fceed5a80ff78ac6f9a437620323131c88cd51
  1. git cherry-pick 67fceed5a80ff78ac6f9a437620323131c88cd51 ( , !)

  2. ( )

  3. git rebase --continue

, (, ).

, , .

, , , "" commit/working tree ( ).

+5

git gc --aggressive . .

+1

, OP --root.

--root

Restore all commits reachable from <branch>, instead of limiting them with <upstream>. This allows you to reinstall root commit (s) on a branch. [...]

As mentioned in another answer, the real problem here is git expects to find parent commits in which it does not exist. In particular, this happens when git looks for a merge base between the two branches. --roottells git not to do this.

Credit jthill and his answer fooobar.com/questions/2111831 / ...

0
source

All Articles