[英]Git merge with beyond compare
I've recently purchased beyond compare pro to merge code shared with git
(of which I have a very limited understanding). 我最近购买了超越compare pro来合并与
git
共享的代码(我对此了解非常有限)。 I now have two branches, a master
and a feature
. 我现在有两个分支,一个
master
分支和一个feature
分支。 I recently pulled the master
from remote so that now the master
is a few commits ahead of the common ancestor between master
and feature
. 我最近从远程撤回了
master
,这样现在master
要比master
和feature
的共同祖先提前几步。
Since my branch feature
has mostly deletions I want to merge master
into feature
and not the reverse (does this make sense?). 由于我的分支
feature
大部分已删除,因此我想将master
合并到feature
而不是将其合并(这有意义吗?)。 So I basically did 所以我基本上做了
git checkout master
git pull origin master
git push origin master
So at this point my feature
is a few commits behind and a few commits ahead of master
. 所以在这一点上,我的
feature
是在master
之后进行一些提交,而在master
之前进行一些提交。 To merge the commits of master
into feature
I did: 要将
master
的提交合并到feature
我做了以下操作:
git checkout feature
git merge master
git mergetool
Now I'm prompted with a series of messages like 现在,系统提示我一系列消息
Deleted merge conflict for 'ED/build/make/rules.mk':
{local}: deleted
{remote}: modified file
Use (m)odified or (d)eleted file, or (a)bort? m
Normal merge conflict for 'ED/src/driver/ed_model.F90':
{local}: modified file
{remote}: modified file
merge of ED/src/driver/ed_model.F90 failed
Continue merging other unresolved paths [y/n]? y
All other files give a failed merge error without even opening the beyondcompare mergetool to do the merge. 所有其他文件都给出了失败的合并错误,甚至没有打开beyondcompare mergetool进行合并。
(m)odified or (d)eleted
, does this mean that I have to choose which file to select between local and remote as a result of the merge? (m)odified or (d)eleted
,这是否意味着我必须选择由于合并而在本地和远程之间选择哪个文件? EDIT 编辑
The relevant part of my .gitconfig is 我的.gitconfig的相关部分是
[diff]
tool = bc3
[difftool]
prompt = false
[difftool "bc3"]
trustExitCode = true
[core]
fileMode = false
symlink = false
ignorecase = true
[merge]
tool = bc3
[mergetool "bc3"]
trustExitCode = true
[alias]
difftool = difftool --dir-dif --no-symlinks
The first prompt says (m)odified or (d)eleted, does this mean that I have to choose which file to select between local and remote as a result of the merge?
第一个提示符说(m)odified或(d)eleted,这是否意味着我必须选择由于合并而在本地和远程之间选择的文件?
Yes. 是。 Probably you want to choose the (d)eleted state, assuming you wish those files to remain deleted in your
feature
branch and don't care how they may have been changed since you originally deleted them. 假设您希望这些文件保留在
feature
分支中,并且不关心自从最初删除它们以来如何进行更改,可能要选择(d)删除状态。
Typically your master
is intended to be in sync with the remote at all times. 通常,您的
master
应始终与遥控器保持同步。 Local changes such as deleting files are properly done in a feature
branch as you are doing, so that's good. 本地更改(例如删除文件)可以在执行
feature
正确地在feature
分支中完成,所以很好。 If your changes are purely local, never intended to become a permanent part of the main project, then they stay in the feature
branch forever, and you occasionally merge from master
to feature
whenever you pull fresh updates from the remote, exactly as you are doing. 如果您所做的更改纯粹是本地性的,决不打算成为主项目的永久组成部分,那么它们将永远保留在
feature
分支中,并且您每次从远程站点获取新更新时,都偶尔会从master
合并到feature
,就像您所做的一样。 The only time you want to merge back from feature
into master
and then push
is to change something for everyone using the project. 您想要从
feature
重新合并到master
然后进行push
的唯一时间是为每个使用该项目的人进行更改。
The second prompt tells me that the merge failed, why is this happening?
第二个提示告诉我合并失败,为什么会这样?
If the answer to any of these is "no" then you return to git with merge markers still in the file, which means "I didn't finish". 如果对上述任何一个的回答为“否”,那么您将返回git,并且合并标记仍在文件中,这意味着“我没有完成”。 In other words, that merge "failed", meaning it did not get completely finished successfully.
换句话说,该合并“失败”,这意味着它没有完全成功完成。
I wouldn't worry about the file addresses looking wrong. 我不会担心文件地址看起来不对。 When git attempts to resolve a merge, it copies the three different versions (remote, local, merged) into three temporary files.
当git尝试解析合并时,它将三个不同的版本(远程,本地,合并)复制到三个临时文件中。 When you're done editing and merging, it copies the 'merged' one back into your local file.
完成编辑和合并后,它将“合并的”文件复制回本地文件。
All other files give a failed merge error without even opening the beyondcompare mergetool to do the merge.
所有其他文件都给出了失败的合并错误,甚至没有打开beyondcompare mergetool进行合并。
This seems strange. 这似乎很奇怪。 Typically git will continue one by one.
通常git将一一继续。 Sorry I can't be of more help here.
抱歉,我在这里没有更多帮助。
If you want to see the unresolved conflicts in Beyond Compare you can run git mergetool
which will open conflicts with your default merge tool. 如果要在“超越比较”中查看未解决的冲突,可以运行
git mergetool
,它将打开与默认合并工具的冲突。 You have to first setup git to use Beyond Compare if you haven't already. 如果尚未安装,则必须先设置git才能使用Beyond Compare。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.