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


当前回答

如果你有一个提交,尝试撤销它,再拉一次!

其他回答

git pull origin main --rebase
git pull --rebase

以上两个命令对我很有用。但唯一的问题是,我在当前分支中也看到了主分支的提交..

这对我很有用

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

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

Git拉原点-rebase

如果原始分支被压缩,或者有一个更改破坏了提交历史,如果你不关心本地分支提交历史,你可以重置本地分支

git checkout branchname
git reset --hard origin/branchname

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

git config pull.ff no