git “不是我们可以合并的东西”是如何产生的?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/14388625/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How does "not something we can merge" arise?
提问by Hamish Downer
This is a new one to me. I'm a fairly experienced user of git, and have just added a remote to a repo that was forked from mine, fetched the updates and then tried to merge them in:
这对我来说是新的。我是一个相当有经验的 git 用户,刚刚向从我的分叉的仓库中添加了一个遥控器,获取更新,然后尝试将它们合并:
$ git merge HEAD f6ff240dbf47234249a68b34c8a98bb11237aa7
fatal: f6ff240dbf47234249a68b34c8a98bb11237aa7 - not something we can merge
There is next to nothing on the web about this error message, which shocks me. The nearest thing I can find is this page about being in a detached head state. But git status
reports that I am on branch master.
网络上几乎没有关于此错误消息的内容,这让我感到震惊。我能找到的最近的事情是这个关于处于超脱头部状态的页面。但是git status
报告说我在分支主机上。
You can see the repositories I am trying to use on github - my repoand the remote I want to pull from. At the time of writing, master of my repo is at 6dc048862a93ffba6cd37883fd43e40651f248c1.
你可以看到,我想在GitHub上使用该储存库-我的回购和远程我想从拉。在撰写本文时,我的 repo 的主人在6dc048862a93ffba6cd37883fd43e40651f248c1。
Looking at the history I can see where the forks diverge, and I am trying to merge a commit from 3 commits up the fork. It doesn't seem that hard.
查看历史记录,我可以看到分叉的分歧点,并且我正在尝试合并来自分叉的 3 个提交的提交。好像没那么难。
To replicate for yourself you could do:
要为自己复制,您可以执行以下操作:
git clone https://github.com/aptivate/dye
cd dye
git remote add qris git://github.com/qris/ping-dye.git
git fetch qris
git checkout master
git merge f6ff240dbf47234249a68b34c8a98bb11237aa7
采纳答案by KingCrunch
It's quite simple: f6ff240dbf47234249a68b34c8a98bb11237aa7
doesn't exist.
很简单:f6ff240dbf47234249a68b34c8a98bb11237aa7
不存在。
I just realize you mean 3f6ff240dbf47234249a68b34c8a98bb11237aa7
(Note the missing 3
at the beginning) Just go to the commit list and type Ctrl+ff6ff
.
我只是意识到你的意思3f6ff240dbf47234249a68b34c8a98bb11237aa7
(注意3
开头的缺失)只需转到提交列表并输入Ctrl+ ff6ff
。
If that is someone you know, you should tell them to alwaysbranch from master
and commit their custom changes there (for every change), instead of committing directly into master
. Then he doesn't need to rebase and force-push the changes from upstream (you) and you only have to merge the specific story-branches.
如果那是你认识的人,你应该告诉他们总是从master
那里分支并提交他们的自定义更改(对于每个更改),而不是直接提交到master
. 然后他不需要从上游(你)重新设置和强制推送更改,你只需要合并特定的故事分支。
回答by Sendor.Wang
I got a same error message. In my case, the reason is I use '(' and ')' in branch name.
我收到了同样的错误信息。就我而言,原因是我在分支名称中使用了 ' (' 和 ' )'。