Fatal: Not possible to fast-forward, aborting

Git

Git Problem Overview


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-only now?

Git Solutions


Solution 1 - Git

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

If your upstream branch is not set, try git pull origin <branch> --rebase (credit to @Rick in the comments)

To set this option globally, use git config --global pull.rebase true (credit to @Artur Mustafin below)

Solution 2 - Git

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.

Solution 3 - Git

git pull --no-ff -> make fast-forwarding to be off by --no-ff

Solution 4 - Git

  • If
git pull

does not do the trick and if you want to merge both the current changes and the changes that'd come from the pull of the branch from origin then do this:-

git merge origin/BRANCH_NAME
  • After that, resolve the merge conflicts if any and done for the day.

Solution 5 - Git

This is because you have enabled the fast-forward only option. The thing here is your pull from the branch will create a merge commit in your local git and the fast-forward only option doesn't allow creating a merge commit at the time of pull.

In the case of a big team, You will end up rebasing and resolving conflicts lots of the time and for each and every commit coming from the pull.

I suggest you remove ff = only line from git local config file.

> $ cd to-my-project-root-dir

> $ nano .git/config

[pull]
        ff = only // remove this line
        rebase = false

Solution 6 - Git

If you get this when doing a git pull origin master on your local branch, open .gitconfig in Notepad (usually hidden in C:\Users\Myname) and add these two lines

[pull]
	ff = no

Save the config and try git pull origin master again

Solution 7 - Git

If you have a commit, try undo it and pull again!

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionJesse LeiteView Question on Stackoverflow
Solution 1 - GitcrypdickView Answer on Stackoverflow
Solution 2 - GitAmberView Answer on Stackoverflow
Solution 3 - GitDheeraj kumar RaoView Answer on Stackoverflow
Solution 4 - GitAman BhardwajView Answer on Stackoverflow
Solution 5 - GitPratik SoniView Answer on Stackoverflow
Solution 6 - GitSushiGuyView Answer on Stackoverflow
Solution 7 - GitFes NguyenView Answer on Stackoverflow