简体   繁体   中英

Git-Rebase: Failed on patch deleting a file that got already modified

I try to rebase my branch to catch up with master. But Git fails with the given problem:

...
warning: squelched 41 whitespace errors
warning: 46 lines add whitespace errors.
Falling back to patching base and 3-way merge...
CONFLICT (modify/delete): project/package/XXX.java deleted in CommitName and modified in HEAD. Version HEAD of project/package/XXX.java left in tree.

It seams that in the branch I deleted a file within a patch and that file got modified on master as well. When I now try to rebase the branch to origin/master, the merge process does not know what to do with the patch since the file I delete has changed now and the patch can not further applied.

What is the best way to fix it?

When a merge conflict like such occurs, you'll notice that you are still in process of rebase . In order to continue, those files need to be staged. You can stage the change with either git rm or git add . Then you have to continue the rebase with git rebase --continue .

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