Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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

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

1 Answer

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...