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
368 views
in Technique[技术] by (71.8m points)

GIT: How dangerous is "deleted by us" conflict?

A few days ago I made a new branch called "new_branch" based on "master". While I worked on my "new_branch" with file "file.php", a second developer on his branch deleted the file "file.php" and merged his branch with "master". Now I need to rebase my branch on current "master". After the command git pull --rebase origin master I have the conflict

deleted by us: app/file.php

I don't know what to do, I don't want to lose changes I've made in this file. After commands

git add -A
git rebase --continue 

will the file disappear in my "new_branch"?

question from:https://stackoverflow.com/questions/42174485/git-how-dangerous-is-deleted-by-us-conflict

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

1 Reply

0 votes
by (71.8m points)

The message deleted by us: app/file.php means precisely what you described, namely that someone deleted this file in the master branch on which you are rebasing new_branch.

Assuming that the delete has not yet been staged and you want to keep this file, then you should git add the file to mark it that it should be kept:

git add app/file.php

Then, resolve all other merge conflicts and do git rebase --continue

Note that if you wanted to accept the delete you would do git rm instead.


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

...