Over the last few weeks, any time I get a merge conflict I get a fatal error.
Steps to reproduce:
- checkout branch name
- git pull origin master
At this point, my VScode would show the conflict(s) in the file and give me the opportunity of which to pick. This has happened for years..
But now, I get this error instead
* branch master -> FETCH_HEAD
fatal: Not possible to fast-forward, aborting.
VScode won't show me the conflict, there appears to be no way to resolve it except for deleting entire branch, creating a new branch from master, then rebuilding all my changes.
CodePudding user response:
The message:
fatal: Not possible to fast-forward, aborting.
means that you've told Git to use --ff-only
for the merge that occurs as the second step of git pull
1 and that this merge cannot be done as a fast-forward.
There was a bug in Git 2.33 where --ff-only
misbehaved in certain cases:
* "git pull --ff-only" and "git pull --rebase --ff-only" should make it a no-op to attempt pulling from a remote that is behind us, but instead the command errored out by saying it was impossible to fast-forward, which may technically be true, but not a useful thing to diagnose as an error. This has been corrected. (merge 361cb52383 jc/fix-pull-ff-only-when-already-up-to-date later to maint).
If you have this version of Git, you should upgrade to 2.34 or later. Your comment implies that you've hit this particular bug.
(Your comment about Bitbucket almost certainly involves something else entirely, and is a Bitbucket issue, not a Git one.)
1Remember that git pull
is a convenience short-cut that means:
- run
git fetch
; - run a second Git command to do something with the commits obtained in step 1.
The default second command is git merge
but you can choose git rebase
instead. The --ff-only
option is an option to git merge
and means nothing to git rebase
, so git pull
won't supply --ff-only
to the second command if you choose git rebase
(but it is supposed to stop the rebase for that case). Whether git merge
supplies --ff-only
to the second command if you choose git merge
depends on how you configure git pull
to operate.
CodePudding user response:
steps to fix:
% vi ~/.gitconfig
in vi, type E
in edit screen, Comment out 2 lines
#[pull]
#ff only
Save, everything works