出现这个问题的原因如标题所述。

原因

原因是,当前文件的branch和要pull的branch名字不一样,是两个分支。对于两个branch,git不能直接操作,需要你指定什么操作。
要操作的提示也直接给你提醒了:

hint: Pulling without specifying how to reconcile divergent branches is
hint: discouraged. You can squelch this message by running one of the following
hint: commands sometime before your next pull:
hint:
hint:   git config pull.rebase false  # merge (the default strategy)
hint:   git config pull.rebase true   # rebase
hint:   git config pull.ff only       # fast-forward only
hint:
hint: You can replace "git config" with "git config --global" to set a default
hint: preference for all repositories. You can also pass --rebase, --no-rebase,
hint: or --ff-only on the command line to override the configured default per
hint: invocation.

就是这三种:

git config pull.rebase false  # merge (the default strategy)
git config pull.rebase true   # rebase
git config pull.ff only       # fast-forward only

所以呢,这个问题本质上是两个分支不同,要怎样合并两个分支的问题。
当前default的,就是第一种,我不允许两个不同分支rebase,第二个是允许,第三个是fast forward。

对于不想管怎么合并,只想把代码弄下来的解决方案

原因部分已经说了,这个提示是因为本地的branch名字和远端的名字不一样才导致的,所以演变成了如何处理两个分支的问题。
那我避免两个分支,本地再建一个和远端同名的分支,然后把当前所有文件放在那个新的分支上,操作完之后直接git pull就可以继续操作了。

直面问题的方案

那就看两个分支到底是怎么合并咯,其实都是merge的操作就是了。
rebase就直接改变分支指针的指向,重新指向新的节点,再fastforward。
fastforward就指针直接移动到最前面嘛。
这两种方式显然都是有条件的,能fast forward那得是一新一旧的关系,一条链上的才行;rebase就不同链上的情况。
手随便画个吧:


然后这几个选项,设置一下,再pull就行了。

git config pull.rebase false  # merge (the default strategy)
git config pull.rebase true   # rebase
git config pull.ff only       # fast-forward only

总结

这个问题本质,是如何操作两个分支合并的问题

Pulling without specifying how to reconcile divergent branches is hint: discouraged. You can squelch相关推荐

  1. git pull和git pull origin master报如下警告Pulling without specifying how to reconcile divergent branches

    git pull和git pull origin master报如下警告 hint: Pulling without specifying how to reconcile divergent bra ...

  2. git报错:(Pulling without specifying how to reconcile divergent branches)

    1 问题背景 如果你也在使用2.27.0及以上版本的Git时,使用git pull命令出现以下的警告文案,可以通过阅读本篇文章来解决此问题. 博主最近在Android Studio上使用git pul ...

  3. 解决git问题:fatal: Need to specify how to reconcile divergent branches.

    在使用git拉取远程项目的时候可能会出现 fatal: Need to specify how to reconcile divergent branches. 如图: 解决方式: 第一步:删除该本地 ...

  4. fatal: Need to specify how to reconcile divergent branches.

    报错:fatal: Need to specify how to reconcile divergent branches. 在新克隆的代码库第一次从别的分支拉取代码时报错:需要指定如何协调分歧分支. ...

  5. You have divergent branches and need to specify how to reconcile the

    解决方法 分析:这是由于你拉取pull分支前,进行过merge合并更新分支操作,导致版本不一致 第一种解决方法: 执行git config pull.rebase false 默认将pull下来的代码 ...

  6. git master和main 的纠缠

    ➜ springbootTrading git:(master) ✗ git status On branch masterNo commits yetUntracked files:(use &qu ...

  7. 【git系列004】解决 git 未指定冲突处理方法的问题

    解决 git 未指定冲突处理方法的问题 hint: Pulling without specifying how to reconcile divergent branches ishint: di_ ...

  8. git pull 报错:error: Pulling is not possible because you have unmerged files.

    报错: $ git pull error: Pulling is not possible because you have unmerged files. hint: Fix them up in ...

  9. Git 出错error: Pulling is not possible because you have unmerged files

    在git pull的过程中,如果有冲突,那么除了冲突的文件之外,其它的文件都会做为staged区的文件保存起来. 重现: $ git pull origin master error: Pulling ...

  10. Git 语法、使用规范及常见bug总结

    分享一下个人总结的git语法.使用规范以及碰到问题的debug(自己感觉能覆盖90%的内容). 觉得有用的话,帮忙点个赞吧_(手动加狗头) 史上最全Git 语法和规范总结 分支管理常见命令 Login ...

最新文章

  1. 清华校庆正当时,智能小车决赛日
  2. Objective-C objc_class 介绍
  3. [总结]Asp.net中的页面乱码的问题
  4. lofter 爬虫_200627 | Lofter格兰芬多标签日榜
  5. 云上城之个服务器维护时间,云上城之歌寒冬边界开服时间表_云上城之歌新区开服预告_第一手游网手游开服表...
  6. 节点操作大全(二)~操作节点的属性
  7. Java的环境变量配置
  8. 通信基础 8 —— MIMO / 3GPP / UMI
  9. html gbk正确 utf-8乱码,GBK与UTF-8互转乱码详解
  10. 购买代购的产品算违法吗——看空姐代购被判刑有感
  11. 停课集训 11.27
  12. 蓝牙运动耳机什么牌子好,分享六款好用的运动耳机
  13. 手机投屏到电脑显示屏
  14. 最新、最全开心网钓鱼外挂下载_开心网001钓鱼外挂
  15. C sharp(#)中的float,double, Single,Double关键字
  16. android 和风图标字体移植显示墨迹天气图标
  17. WebRTC的Jitter计算
  18. 黑客滥用FBI邮件服务器大规模发送虚假威胁警报,不安全编码是元凶
  19. 蓝桥杯单片机比赛学习:6、中断系统之定时器中断的基本原理
  20. php 给字符中间添加间距,html中的字符间距怎么设置?css样式设置文本对齐方式总结...

热门文章

  1. J-LINK驱动下载
  2. [ZJOI2008]树的统计
  3. 【国土】国土“三调”,用这个方案就对了
  4. 基于Django图书管理系统设计与实践
  5. UNetFusionNet
  6. 计算机专业ppt,计算机专业职业生涯规划PPT(11页)
  7. 虚拟机专用精简版win7系统_新手玩NAS:创建虚拟机,安装WIN10,实现迅雷下载和百度云...
  8. C语言根号作用,c语言中如何开根号运算
  9. 【MFC】测边网平差计算
  10. 贝叶斯网络、马尔可夫模型、马尔可夫过程、马尔可夫链、马尔可夫网络基本概念