Git - 错误集

错误1:fatal: refusing to merge unrelated histories

$ git pull 20221109test master
From https://gitee.com/chaung_sun/20221109test
 * branch            master     -> FETCH_HEAD
fatal: refusing to merge unrelated histories

$ git merge 20221109test/master
fatal: refusing to merge unrelated histories


===========> 解决:
$ git pull 20221109test master --allow-unrelated-histories

错误2:开发完项目初始化本地仓库后,第一次推送出现:Updates were rejected because the tip of your current branch is behind

$ git push origin master
To https://gitee.com/chaung_sun/douban.git
 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'https://gitee.com/chaung_sun/douban.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.


# 加上--rebase参数解决问题 或者 强制拉取 git push origin master -f

86158@DESKTOP-9PANV23 MINGW64 /e/PyProject/douban (master)
$ git pull origin master --rebase
From https://gitee.com/chaung_sun/douban
 * branch            master     -> FETCH_HEAD
First, rewinding head to replay your work on top of it...
Applying: add douban

--rebase的作用:
1.https://blog.csdn.net/yao_hou/article/details/108178717
2.https://blog.csdn.net/TomorrowAndTuture/article/details/107677939?spm=1001.2101.3001.6661.1&utm_medium=distribute.pc_relevant_t0.none-task-blog-2~default~CTRLIST~Rate-1-107677939-blog-108178717.pc_relevant_landingrelevant&depth_1-utm_source=distribute.pc_relevant_t0.none-task-blog-2~default~CTRLIST~Rate-1-107677939-blog-108178717.pc_relevant_landingrelevant&utm_relevant_index=1

posted @   chuangzhou  阅读(24)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 单线程的Redis速度为什么快?
· SQL Server 2025 AI相关能力初探
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 展开说说关于C#中ORM框架的用法!
点击右上角即可分享
微信分享提示