如何在 git 中使用我的更改进行合并?
在 git 中合并时如何强制“我的更改”?有人将所有 bin 目录放入 git 中,现在我遇到了可怕的合并冲突:(
现在它显示以下内容:
当你解决了这个问题后 运行“git rebase --继续”。如果你 宁愿跳过这个补丁, 而是运行“git rebase --skip”。到 恢复原来的分支并停止 变基运行“git rebase --abort”。
我不想合并,我只想使用我的更改删除所有这些文件。
编辑:大多数文件已成功合并,无论是通过自动合并还是因为没有冲突。然而,不少仍然存在,如下所示。
警告:无法合并二进制文件: src/reports/obj/Debug/TempPE/GroupMailDS.Designer.cs.dll (HEAD 与添加的 gitignore)
How do I force "my changes" when merging in git? Someone put all bin directories in git and now I have a terrible merge conflict :(
Now it says the following:
When you have resolved this problem
run "git rebase --continue". If you
would prefer to skip this patch,
instead run "git rebase --skip". To
restore the original branch and stop
rebasing run "git rebase --abort".
I do NOT want to merge, i just want to delete all those files using my changes.
EDIT: Most of the files was successfully merged, either through automatic merge or because there was no conflict. However quite a few still exist like the following one.
warning: Cannot merge binary files:
src/reports/obj/Debug/TempPE/GroupMailDS.Designer.cs.dll
(HEAD vs. added gitignore)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我对此不是 100% 有信心,但我认为这是一个很好的例子:
该命令尝试使用递归策略将主题分支合并到您签出的分支中。 -X ours 选项是递归策略的一个子集,它通过假设当前签出的分支是权威的来自动解决冲突。
I'm not 100% confident about this, but I think this is a good case for this:
That command attempts to merge the topic branch into your checked out branch using the recursive strategy. The -X ours option is a subset of the recursive strategy that automatically resolves conflicts by making the assumption that your currently checked out branch is authoritative.
您可以:
git rm
obj
目录(其中包含所有这些二进制文件,不应该首先提交)git status
中(并且不会添加)git push
该新树,有助于传播“obj”这一事实
' 目录也应该从其他 Git 存储库中消失(因此根本不会触发合并)。如果您能征得所有其他参与者的同意,您可以:
git push -f
(强制推送)到“中央”git 存储库,其他开发人员可以从中获取并重置他们自己的分支。但由于它涉及用新的历史记录替换已发布的历史记录,因此只有在其他用户同意的情况下才应该这样做。
You can:
git rm
theobj
directory (which contains all those binary files and shouldn't have been committed in the first place)git status
(and won't be added)git push
that new tree, helping to propagate the fact that 'obj
' directory should disappear from other Git repos as well (hence triggering no merge at all).If you can have the consent of all the other participants, you could:
git push -f
(forced push) to a "central" git repo from which the other developers could fetch and reset their own branches.But since it involves replacing published history by a new one, it should be done only if the other users agree.
我想你可以用你的二进制文件替换他们的二进制文件(因为实际上不可能合并)或者只是 git rm 不需要的二进制文件。完成后,只需 git rebase --Continue
I guess you can just replace their binaries with yours (since no merge is really possible) or just git rm the unwanted binaries. After you have done, just git rebase --continue