无法合并上游的变化回到我的分支 [英] Trouble merging upstream changes back into my branch

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

问题描述

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



我创建了自己的fork 。我克隆它。我对我的分支进行了更改,提交并推送。但是之后主叉更新了,我尝试通过合并上游来更新自己的叉,如下所示:

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

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


致命:'merge'是不可能的,因为你有没有合并的文件。
请修正它们在工作树中,然后使用'git add / rm'作为
来标记分辨率并进行提交,或者使用'git commit -a'。


是否有一些论点我要离开?我在做一些愚蠢的事情吗? 未合并文件是什么意思?合并文件不是整个合并点吗?在合并前我必须提交更改吗?

文件。您需要手动解决这些冲突。运行 git mergetool git gui


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

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

解决方案

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天全站免登陆