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


当前回答

这是我的工作,你可以用它git pull -no- off

其他回答

尝试一下,会工作得很好----

Git拉原点-rebase

对我来说,这是有效的,改变branch_name与实际的分支:

git pull origin branch_name --no-ff

你的分支不再直接基于你试图合并到的分支——例如,另一个提交被添加到目标分支,而这个分支并不在你的分支中。因此,您不能快进到它(因为快进要求您的分支完全包含目标分支)。

你可以在目标分支的基础上重新建立你的分支(git rebase <destination branch>)来重新提交,这样它们就会快速前进到目标分支中,或者你可以做一个常规的合并。

免责声明:这些命令将从远程分支到您的分支中带来更改。

快拉,变基。与其他解决方案不同,您不需要知道目标分支的名称。

如果你的上游分支没有设置,尝试git拉origin <branch>—rebase(在评论中归功于@Rick)

要全局设置这个选项,使用git config——global pull。rebase true(归功于@Artur Mustafin)

这对我很有用

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