5

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).

Ionuț G. Stan
  • 176,118
  • 18
  • 189
  • 202

2 Answers2

10

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

Alexander Groß
  • 10,200
  • 1
  • 30
  • 33
  • Thanks, it seems to solve the issue. Well, I have some conflicts, but that's another story. – Ionuț G. Stan Aug 11 '10 at 10:47
  • Using 'merging strategies' to rebase did the trick for me too when I had the following errors: `error: mode change for , which is not in current HEAD error: could not build fake ancestor` (I'm posting this in case it helps someone pattern match their issue against this solution which worked for me). I'm not sure what rebase does when _not_ using a merging strategy (the default being recursive which seems to have fixed this)... – Silas Davis Jan 31 '17 at 15:52
0

I had the same thing and it turned out to be caused by a commit message that had a diff in the message.

Maybe try: git log --grep ++

... see if that's it ..

matiu
  • 7,469
  • 4
  • 44
  • 48