atal: refusing to merge unrelated histories
时间: 2023-09-26 13:10:55 浏览: 113
fatal: refusing to merge unrelated histories是Git在合并分支时出现的错误。在Git 2.9之后的版本,Git不再允许合并两个没有共同基础的分支。这是为了防止不必要的历史合并,以免将新创建的项目的历史合并到已存在的项目中。然而,你仍然可以通过使用--allow-unrelated-histories选项来允许合并两个独立的项目。解决办法是使用命令git pull origin main --allow-unrelated-histories。这将允许你合并两个没有共同基础的分支。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *2* [git初始化错误fatal: refusing to merge unrelated histories](https://blog.csdn.net/qq_46006194/article/details/128613564)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
- *3* [git pull 提示错误 fatal: refusing to merge unrelated histories](https://blog.csdn.net/ZCaesarK/article/details/125316158)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文