2019-11-29-git无法pull仓库refusing-to-merge-unrelated-histories
Git to 无法 11 2019 仓库 29 Merge
2023-09-27 14:28:48 时间
title | author | date | CreateTime | categories |
---|---|---|---|---|
git无法pull仓库refusing to merge unrelated histories |
lindexi |
2019-11-29 08:21:50 +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
这个功能是可以让大家不要把仓库上传错了,如果会加上这个代码,那么就是自己确定了上传。之前很容易就把代码传错了,现在可以看到,如果上传的仓库不是之前在上传的仓库,是一个新的仓库,那么就会提示需要添加上面代码才能上传
相关文章
- 在Visual Studio 中使用git——分支管理-上(八)
- How to use git commands after enable gitlab's second-factor authentication
- git svn
- Git基础
- git经常使用命令和问题
- git pull出现fatal: unable to access 'https://github.com/XXX/YYY.git'
- git commit 提交不了 error: pathspec 'project'' did not match any file(s) known to git.
- ubuntu部署git
- 使用git send-email报:Please install an MTA on this system if you want to use sendmail如何处理?
- 使用git send-email发送邮件时报错: Unable to initialize SMTP properly怎么处理?
- centos6.8下如何升级git版本?
- git clone时,提示warning: remote HEAD refers to nonexistent ref, unable to checkout
- 针对远程Git代码库使用SSH公匙
- 设置Git--在Git中设置您的用户名--创建一个回购--Fork A Repo--社会化
- vue单页(spa)前端git工程拆分实践
- git常用命令
- 如何解决failed to push some refs to git
- Git error: unable to create file xxx: Filename too long
- Git Pull Failed Your local changes would be overwritten by merge. Commit, stash or revert them to proceed
- 浅析Git Subtree的原理与实际应用:git subtree是什么、子仓库与仓库共用、共用代码需求常规处理方式及为什么使用git subtree以及如何使用Git Subtree在多个Git项目间双向同步子项目
- git error: unable to unlink old (Permission denied)
- git的使用
- [转]git clone出现 fatal: unable to access 'https://github.com/...'的解决办法(亲测有效)
- git push -u origin master 提交失败时的解决方案
- git clone失败:fatal: unable to access 'https://github.com/NVIDIA/apex/': gnutls_handshake() failed: The TLS connection was non-properly terminated.