Git merge conflict since I deleted the file

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

So, I developed a github project that I am making changes to work the way I want it. One of my changes is to delete the file. So I deleted the file using 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 he gave a message that there was a conflict with the file that I deleted (since it was deleted in my repo, but it was modified in the "original-remote-repo"). I do not care about any changes to this file since I deleted it.

Is there anything I need to do to merge them without re-creating the file (since I still have to delete it)? Or is there a better workflow I should accept?

+4
source share
1 answer

There is a merge conflict because you changed the content in your repository (i.e. deleted this file), and upstream also changed the content to the same place (i.e. to this file).

Git has no way of knowing if you want changes or their changes, because it cannot determine which one is β€œright” (that is, it cannot merge the changes completely).

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

Changes upstream most likely depend on their changes in this file, so your merge will probably not work (in the end, they almost certainly changed this file for some reason!), But I'm sure that you this is because it is now your responsibility to manage this difference, at least for your tree, so I will consider merge commit and make other changes that guarantee that they will still work.

+5
source

All Articles