无法将上游更改合并回我的分支 [英] Trouble merging upstream changes back into my branch

查看:36
本文介绍了无法将上游更改合并回我的分支的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在尝试将上游更改合并回我的分支时遇到冲突,我不知道如何解决它们.

I'm running into conflicts while trying to merge upstream changes back into my branch and I'm not sure how to resolve them.

我创建了自己的分叉.我克隆了它.我对分支上的分支进行了更改、提交和推送.但是随后主分支更新了,我尝试通过像这样合并上游来更新我自己的分支:

I created my own fork. I cloned it. I made changes to the branch on my fork, committed, and pushed. But then the main fork updated, and I tried to update my own fork by merging upstream in like so:

$ cd repo-name
$ git remote add upstream git://github.com/username/repo-name.git
$ git fetch upstream
$ git merge upstream/master

合并表示文件有问题,自动合并不起作用.它告诉我自己修复它并重新合并.所以我实际上去了主分支的 GitHub 上的(上游)存储库,并将新文件的所有代码复制到我的分支上的文件中,并尝试再次合并.然后,git 给了我这个错误:

The merge says that there's some problem with a file and auto-merging doesn't work. It tells me to fix it myself and re-merge. So I actually went to the (upstream) repository on GitHub of the main fork and copied all the code of the new file into the file on my fork, and tried to merge again. Then, git gives me this error:

fatal: 'merge' 是不可能的,因为你有未合并的文件.请在工作树中修复它们,然后使用git add/rm"作为适合标记分辨率并进行提交,或使用 'git commit -a'.

fatal: 'merge' is not possible because you have unmerged files. Please, fix them up in the work tree, and then use 'git add/rm ' as appropriate to mark resolution and make a commit, or use 'git commit -a'.

有什么我要忽略的论点吗?我在做蠢事吗?未合并的文件"是什么意思?不是合并以合并文件的全部意义吗?我是否必须在合并之前提交更改?

Is there some argument I'm leaving out? Am I doing something stupid? What does it mean by "unmerged files?" Isn't the whole point of merging to merge files? Do I have to commit my changes before I merge?

推荐答案

您所看到的意味着自动合并无法解决文件中的冲突.您需要手动解决这些冲突.运行 git mergetoolgit gui.

What you are seeing means that automatic merge could not resolve the conflicts in the files. You need to resolve these conflicts manually. Run git mergetool or git gui.

这篇关于无法将上游更改合并回我的分支的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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