zoukankan      html  css  js  c++  java
  • 2018-11-14-git无法pull仓库refusing-to-merge-unrelated-histories

    title author date CreateTime categories
    git无法pull仓库refusing to merge unrelated histories
    lindexi
    2018-11-14 16:58:10 +0800
    2018-2-13 17:23:3 +0800
    git

    本文讲的是把git在最新2.9.2,合并pull两个不同的项目,出现的问题 如何去解决 fatal: refusing to merge unrelated histories 合并两个不同历史的仓库

    一开始是我在 Github 新建一个仓库,写了 License ,然后把本地一个写了很久仓库上传。

    因为已经创建了和本地不同的,不是一个空仓库,在上传之前先pull,因为两个仓库不同,发现refusing to merge unrelated histories,无法 pull 所以上传失败,谷歌了很久才发现为何这样。

    原来在 2.9.2 之后,不可以合并不同没有相同结点的分支,如果需要合并两个不同结点的分支,那么需要在git pull 添加一句代码--allow-unrelated-histories。于是修改之后的代码,假如源是origin,分支是master,那么请看下面代码。

    git pull origin master --allow-unrelated-histories

    这个功能是可以让大家不要把仓库上传错了,如果会加上这个代码,那么就是自己确定了上传。之前很容易就把代码传错了,现在可以看到,如果上传的不是之前的,那么就需要加代码。

  • 相关阅读:
    svn不提交.net项目中的bin
    java 与C# 时间格式 交互
    生成菜单序列号
    ashx 方法模板
    webservice使用方法
    如何配置IIS服务器?
    zepto.fullpage
    模拟单选框
    star score
    Hover show tips
  • 原文地址:https://www.cnblogs.com/lindexi/p/12086194.html
Copyright © 2011-2022 走看看