Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fatal error with `git rebase upstream-branch` in topic branch

Tags:

git

rebase

I have an issue when I try to rebase an upstream branch into a topic branch. The workflow is like this:

git checkout upstream
git pull origin upstream
git checkout topic
git rebase upstream

The result looks like this:

First, rewinding head to replay your work on top of it...
Applying Refactored database access and added logging
error: patch failed: path/to/file1.ext:21
error: path/to/file1.ext: patch does not apply
error: path/to/file2.ext:3
error: path/to/file2.ext: patch does not apply
fatal: mode change for path/to/file3.ext, which is not in current HEAD
Repository lacks necessary blobs to fall back on 3-way merge.
Cannot fall back to three-way merge.
Patch failed at 0001.

That happened to me yesterday, and I've done my research and found nothing, so in the end I used git merge upstream instead of git rebase upstream and things worked. The real problem is that the error appears today too. I'm already synchronized with upstream due to yesterday's merge. Also, I've not modified files introduced by my team mates since yesterday.

My Git version is 1.5.6.5 (and don't really feel like updating it on this machine, I'm afraid of the unwanted consequences).

like image 226
Ionuț G. Stan Avatar asked Aug 11 '10 09:08

Ionuț G. Stan


1 Answers

I have found that rebasing with the --merge option helps in such cases. (Git will do a rebase nonetheless.)

like image 133
Alexander Groß Avatar answered Nov 15 '22 01:11

Alexander Groß