Karel Bílek
Karel Bílek

Reputation: 37658

Not possible to fast-forward even with no changes

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...

Upvotes: 29

Views: 69403

Answers (3)

j2emanue
j2emanue

Reputation: 62519

Your commits on your 'develop' branch do not match the commits on your 'origin' branch. Do this:

git pull origin develop --rebase

Upvotes: 40

Plexander
Plexander

Reputation: 61

A workaround.

I'm using Xcode via Beanstalk to Push/Pull to the Git. Here’s how I worked around this problem.

 The problem: 
 During the Xcode 7 to 8 upgrade, code added by my constituents was not Pulled
 into my Xcode, thus causing a Not Possible to Fast Forward error. 

The workaround: My constituents overseas duplicated the Master Branch to a new branch called NEW Branch, then pushed the code. I then pulled.

We’re up and running.

I then went to our account in Beanstalkapp.com and changed my base branch from Master to NEW.

My last move would be to merge the Master into the NEW Branch, but I probably will do a Compare within Beanstalk, then pick out the changes I had made that have not been put into the code in the Git server, then add them manually within the NEW Branch.

Hope that helps.

Upvotes: 0

Jan Krüger
Jan Krüger

Reputation: 18530

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.

  • Use git log ..origin/foo to see what commits are new on the remote side.
  • Use 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).
  • If you conclude that those commits are not needed or already present in a different form on the remote side, 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).

Upvotes: 28

Related Questions