为什么Git不允许我快进合并了?如果我试图使用——ff-only强制它,我会得到消息“致命:不可能快进,终止。”我意识到合并-no-ff有巨大的优势,但我只是不明白为什么我现在不能-ff-only ?


当前回答

我也面临着相同类型的问题,我猜我们中的许多人会面临这个问题,当我们进行结对编程时,我们也有来自其他用户的传入提交。这是我所面临的步骤,并通过git拉来解决它们——没有rebase

➜  graphql-tutorial git:(filtering)  git config pull.ff only 
➜  graphql-tutorial git:(filtering) git pull
fatal: Not possible to fast-forward, aborting.
➜  graphql-tutorial git:(filtering) git merge 
➜  graphql-tutorial git:(filtering)  git config pull.rebase false 
➜  graphql-tutorial git:(filtering) git pull                      
fatal: Not possible to fast-forward, aborting.
➜  graphql-tutorial git:(filtering) git pull --no-rebase
Merge made by the 'ort' strategy.
. <file name>
. <file name>
. <file name>
. <file name>
 5 files changed, 47 insertions(+), 9 deletions(-)
 create mode 100644 app/models/auth_token.rb

其他回答

这对我很有用

Git pull——no-ff

如果你面对这件事

Please enter a commit message to explain why this merge is necessary,
# especially if it merges an updated upstream into a topic branch.
#
# Lines starting with '#' will be ignored, and an empty message aborts
# the commit.

然后执行以下步骤

按我 pressEsc 新闻:wq

您可以在终端上尝试这一点,它实际上编辑您的<。Gitconfig >文件并设置ff = no

git config pull.ff no

我的解决办法可能会帮助到某人。

我得到这个错误的原因是,我没有做git签出,而是做了git checkout -b,创建了一个分支。

试着通过签出远程分支来重做这个过程。

如果在未来得到这个git错误,这个解决方案将帮助你

从(development/master/main)导入到本地分支时出现错误: 错误信息:

hint: You have divergent branches and need to specify how to reconcile them. hint: You can do so by running one of the following commands sometime before hint: your next pull: hint: 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 --re base, --no-re base, hint: or --ff-only on the command line to override the configured default per hint: invocation. fatal: Need to specify how to reconcile divergent branches.

解决方案: 打开.git配置文件并添加这一行 1)(拉) Ff = no 如果第一步对你不起作用,那么就应用第二步

2)git pull -ff-only或git config -global pull。ff只

如果您在本地分支上执行git pull origin master时遇到此情况,请在记事本中打开.gitconfig(通常隐藏在C:\Users\Myname中)并添加这两行

[pull]
    ff = no

保存配置并再次尝试git pull origin master