解决Git中fatal: refusing to merge unrelated histories

2019-05-29 14:19:19

Git的报错

在使用Git的过程中有时会出现一些问题,那么在解决了每个问题的时候,都需要去总结记录下来,下次不再犯。

一、fatal: refusing to merge unrelated histories

今天在使用Git创建项目的时候,在两个分支合并的时候,出现了下面的这个错误。

~/SpringSpace/newframe on  master ⌚ 11:35:56$ git merge origin/druid
fatal: refusing to merge unrelated histories

这里的问题的关键在于:fatal: refusing to merge unrelated histories 
你可能会在git pull或者git push中都有可能会遇到,这是因为两个分支没有取得关系。那么怎么解决呢?

二、解决方案

在你操作命令后面加--allow-unrelated-histories 
例如: 
git merge master --allow-unrelated-histories

~/SpringSpace/newframe on  druid ⌚ 11:36:49$ git merge master --allow-unrelated-historiesAuto-merging .gitignore
CONFLICT (add/add): Merge conflict in .gitignoreAutomatic merge failed; fix conflicts and then commit the result.

如果你是git pull或者git pushfatal: refusing to merge unrelated histories 
同理: 
git pull origin master --allow-unrelated-histories 
等等,就是这样完美的解决咯!


  • 2020-12-01 16:14:54

    HTTP状态码429的含义

    发生429是服务器接口并发太多引起的,可根据代码进行修改,放开限制次数

  • 2020-12-01 16:19:26

    vue中动画分布解析

    enter, enter-active, enter-active-to, (开始 进入阶段的)第1帧 属性值,到 (默认属性值 的过渡阶段),移除enter动画, leave, leave-active, leave-active-to (开始 离开 阶段的)第1帧 默认属性值,到 (属性值 的过渡阶段),移除leave动画

  • 2020-12-01 16:21:47

    Meteor与express结合开发

    Meteor本质上是一个已经公开了连接 http服务器的节点应用程序,这意味着您可以像下面这样定义服务器路由:,如果您坚持使用Express,则可以将Express路由注册为Connect中间件,如下所示:

  • 2020-12-01 16:25:32

    nuxtjs引入jquery

    nuxt引入jQuery库 nuxtjs如何添加 Webpack 插件?

  • 2020-12-01 16:43:37

    fieldset标签做输入框

    比如 vuetify中的 input组件,就用到了fieldset做边框, 这个时候我们想改边框,却找不到border,因为fieldset是靠color来修改边框颜色的。