Git push failed, "Non-fast forward updates were rejected"

Sarath picture Sarath · Aug 1, 2011 · Viewed 181.9k times · Source

I've edited my GIT repositories via Git Online. After I tried to push my local code changes, I got an error:

Git push failed, To prevent from losing history, non-fast forward updates were rejected.

How can I fix this?

Answer

iafonov picture iafonov · Aug 1, 2011

Pull changes first:

git pull origin branch_name