简体   繁体   中英

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

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

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM