我就是这么做的。
中。
现在,当我试图推送它时,它说先拉那些远程提交,但是当我做git时,它会显示错误。
warning: Pulling without specifying how to reconcile divergent branches is discouraged. You can squelch this message by running one of the following commands sometime before your next pull:
git config pull.rebase false # merge (the default strategy)
git config pull.rebase true # rebase
git config pull.ff only # fast-forward only所以我只运行了命令git config pull.ff only
现在,当我拉它的时候,它是这样写的,fatal: Not possible to fast-forward, aborting.
发布于 2022-11-04 17:26:24
好吧..。当前设置(使用pull.ff only)的问题是,它是一个非常严格的设置。
假设这个启动图
A <- B <- C <- D <- (main)您可以从main启动一个特性分支:
A <- B <- C <- D <- (main)
^
\- (feature)过了一段时间,图表是这样的:
A <- B <- C <- D <- F <- G <- (main)
^
\- (feature)注意feature没有移动。此时,feature正指向main的一个祖先,因此快速转发将起作用,这将实现以下操作:
A <- B <- C <- D <- F <- G <- (main)
^
\- (feature)因为,顾名思义,快速转发只会移动指针,因此它不会在进程中进行任何重基/合并。
但是,在一个普通的特性分支上,您将引入commit,因此您将拥有如下内容:
A <- B <- C <- D <- F <- G <- (main)
^
\- I <- J <- K <- (feature)在这种情况下,考虑到feaure没有指向main的祖先,那么就不可能做FF.但是你的设置要求只有当它是FF的时候才运行.所以它失败了。您需要能够重新定位或合并才能使其工作,因此pull.ff only是一个no-go。
https://stackoverflow.com/questions/74319660
复制相似问题