Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
572 views
in Technique[技术] by (71.8m points)

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

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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...