git 致命:无法快进,中止

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/13106179/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 14:50:11  来源:igfitidea点击:

Fatal: Not possible to fast-forward, aborting

git

提问by Jesse Leite

Why is Git not allowing me to fast forward merge anymore? If I try to force it using --ff-only, I get the message "fatal: Not possible to fast-forward, aborting." I realize that there are huge advantages to merge --no-ff, but I'm just puzzled why I can't --ff-onlynow?

为什么 Git 不再允许我进行快进合并?如果我尝试使用 强制它--ff-only,我会收到消息“致命:无法快进,正在中止”。我意识到 有巨大的优势merge --no-ff,但我很困惑为什么我--ff-only现在不能?

回答by Amber

Your branch is no longer directly based off of the branch you're trying to merge it into - e.g. another commit was added to the destination branch that isn't in your branch. Thus, you can't fast-forward into it (because fast-forward requires your branch to completely contain the destination branch).

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

You can rebase your branch on top of the destination branch (git rebase <destination branch>) to rework the commits such that they will fast forward into it, or you can do a regular merge.

您可以在目标分支 ( git rebase <destination branch>)之上重新设置分支以重新处理提交,以便它们快速前进,或者您可以进行常规合并。

回答by crypdick

git pull --rebase. Unlike the other solution, you don't need to know the name of your destination branch.

git pull --rebase. 与其他解决方案不同,您不需要知道目标分支的名称。