I ended up in a weird git state. I want to pull from server, only fast forwards.
However, even when there were no changes, git keeps telling me "not possible fast-forward".
$ git pull -v --ff-only
From github.com:username/repo
= [up to date] branch -> origin/branch
= [up to date] branch2 -> origin/branch2
= [up to date] branch3 -> origin/branch3
fatal: Not possible to fast-forward, aborting.
How do I tell git to tell me more information about this "non-possibility" of fast-forward? I canot be more verbose...
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.
After the git fetch I recommend examining the situation with gitk --all. Git push rejected non-fast-forward means, this error is faced when git cannot commit your changes to the remote repository. This may happen because your commit was lost or if someone else is trying to push to the same branch as you.
Using the --no-ff parameter prevents the Git merge command from performing a fast-forward merge when Git detects that the current HEAD is an ancestor of the commit that you're trying to merge.
A non-fast-forward merge is a merge where the main branch had intervening changes between the branch point and the merge back to the main branch. In this case, a user can simulate a fast-forward by rebasing rather than merging. Rebasing works by abandoning some commits and creating new ones.
Your commits on your 'develop' branch do not match the commits on your 'origin' branch. Do this:
git pull origin develop --rebase
This happens when (a) you committed something on that branch earlier, or (b) the history on the remote server changed in a non-standard way (this shouldn't normally happen but repository owners sometimes don't play by the rules).
For the following I'm assuming you're on foo
and the upstream branch is origin/foo
.
git log ..origin/foo
to see what commits are new on the remote side.git log origin/foo..
to see what commits exist on your side that don't exist on the remote side (this will show you any commits that are preventing fast-forwarding).git reset --hard origin/foo
to force your branch to become equal to the remote one (this will destroy all uncommitted changes and any commits not contained in remote/foo
will become unreachable).If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With