开发者

Git merge conflict since I deleted a file

I'm new to Git, so let me know if there is a better way to do this...

So I forked a project on github that I am making changes to work the way that I want it to. One of the changes I made was to remove a file. So I removed the file with git rm filename. Now I want to pull the latest changes from the original repo that I forked, so I did git pull original-remote-repo master. But it gave a message saying there was a conflict with the file that I deleted (since it's de开发者_如何学Cleted in my repo, but changes were made to it in the "original-remote-repo"). I don't care about any changes to this file since I deleted it.

Is there something I need to do in order to merge these without recreating the file (since I would have to delete it again anyway)? Or is there a better workflow that I should be adopting?


There is a merge conflict because you've changed content on your repository (ie, deleted the file in question), and upstream has also changed content to the same location (ie, that file in question).

Git has no way of knowing if you want your changes, or their changes, because it can't determine which one is "correct" (that is, it can't merge the changes cleanly).

I suggest resolving the merge conflict by deleting the file. (Yes, again).

The changes upstream has made most likely depends on their changes to this file, so your merge probably wont' work (After all, they almost certainly changed that file for a reason!), but I'm sure that you'll figure that out because it's now your responsibility to manage that difference, at least, for your tree, so I would review the merge commit and make other changes that ensure that it still works.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜