git - merge conflict when local is deleted but file exists in remote

前端 未结 6 774
被撕碎了的回忆
被撕碎了的回忆 2020-11-28 04:58

I am very new to git and wondered how I should go about a merge where in the local repo I have deleted several files on the master branch but these files exist within the re

6条回答
  •  谎友^
    谎友^ (楼主)
    2020-11-28 05:26

    You should resolve the conflicts as you see fit. If the file really is supposed to be removed, and you will be publishing that change to origin, remove it again:

    git rm path/to/file
    

    If the file should in fact be tracked still, add it (the version in the work tree will be the version from origin):

    git add path/to/file
    

    After doing either of those to resolve the conflict, commit the merge.

提交回复
热议问题