GIT:“被我们删除"有多危险?冲突? [英] GIT: How dangerous is "deleted by us" conflict?

查看:86
本文介绍了GIT:“被我们删除"有多危险?冲突?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

几天前,我基于"master"创建了一个名为"new_branch"的新分支.当我使用文件"file.php"处理"new_branch"时,他分支上的第二个开发人员删除了文件"file.php",并将其分支与"master"合并.现在,我需要将分支基于当前的"master".在命令git pull --rebase origin master之后出现冲突

被我们删除:app/file.php

我不知道该怎么办,我不想丢失在此文件中所做的更改.命令后

git add -A
git rebase --continue 

文件会在我的"new_branch"中消失吗?

解决方案

消息deleted by us: app/file.php恰好表示您所描述的内容,即某人在您重新建立new_branchmaster分支中删除了此文件. /p>

假设尚未进行删除,并且您想保留此文件,则应git add将该文件标记为应保留:

git add app/file.php

然后,解决所有其他合并冲突并执行git rebase --continue

请注意,如果您想接受删除,则可以执行git rm.

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"?

解决方案

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.

这篇关于GIT:“被我们删除"有多危险?冲突?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆