git - 合并冲突当本地被删除但文件存在于远程 [英] git - merge conflict when local is deleted but file exists in remote
问题描述
我对git非常陌生,想知道我应该如何解决合并问题,我已经在主分支中删除了几个文件,但这些文件存在于远程主分支中。
在完成git-merge之后,它显示了发生的冲突。
使用git gui它显示本地文件被删除,而远程分支文件包含内容。
如何阻止这些文件发生冲突?
有没有简单的方法使用git gui?
非常感谢
git rm path / to / file
如果文件实际上应该被追踪,请将其添加工作树将成为原始版本):
git add path / to / file
完成其中的任何一个来解决冲突后,提交合并。
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 remote master branch.
After doing git-merge it shows the conflicts that have occured.
Using git gui it shows that the local file is deleted, while the remote branch file has contents.
How do you stop these files from being conflicted? Is there a simple way using git gui?
Many thanks
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.
这篇关于git - 合并冲突当本地被删除但文件存在于远程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!