git · Git
报错原文
fatal: Need to specify how to reconcile divergent branches.
这是什么意思
从 git 2.34 起,分支分岔时 pull 不再替你猜是要合并还是 rebase,它在要一个配置,而不是在报告损坏。当两条分支已经分岔而你从未设过 pull.rebase 时就会看到它。pull.ff only 最稳妥,因为它只在能快进时才拉取,否则什么都不建就停下;pull.rebase true 每次都会改写你本地提交的哈希,而 false 会留下一个合并提交。
怎么修
git config pull.ff only- 来自
- git
- Git
- 29
git 的错误几乎都是一种拒绝,意思是「在当前状态下做那件事会丢掉东西」;fatal: 表示它什么都没改就停了,而真正的解决办法往往在第一行下面的 hint: 行里。
怎么读报错
- 从第一行往下读。越往下越是工具内部的事,起因通常写在最上面。
- 有文件名和行号就从那里查——不是栈顶那一帧,而是最上面那条提到你自己写的文件的行。
- 把报错原文照样去搜,但先去掉你自己的路径和变量名,正是那些让搜索匹配不上。
- 同一种情况在不同版本里措辞不同。结果不对头,就把版本号一起加进查询。
- 粘贴修法之前,先确认它会丢掉什么。这里面有些是不能撤回的。
常见问题
Q. “fatal: Need to specify how to reconcile divergent branches.” 是什么意思?
从 git 2.34 起,分支分岔时 pull 不再替你猜是要合并还是 rebase,它在要一个配置,而不是在报告损坏。当两条分支已经分岔而你从未设过 pull.rebase 时就会看到它。pull.ff only 最稳妥,因为它只在能快进时才拉取,否则什么都不建就停下;pull.rebase true 每次都会改写你本地提交的哈希,而 false 会留下一个合并提交。
Q. 怎么修?
git config pull.ff only —— 执行前先看上面的说明,确认这条命令会丢掉什么。
Q. 这是哪个工具报的?
git。它属于Git,报错原文有 9 个词。
相关报错
Your branch and 'origin/main' have divergedgit! [rejected] main -> main (fetch first)gitCONFLICT (content): Merge conflict in src/app.tsxgitPlease commit your changes or stash them before you merge.giterror: Your local changes to the following files would be overwritten by checkout:gitYou are currently rebasing branch 'feature' on '8a3f21c'.gitYou are in 'detached HEAD' state.gitWarning: you are leaving 1 commit behind, not connected to any of your branches:git