AnApprentice AnApprentice - 5 months ago 24
Git Question

Deploying to heroku with git keeps getting rejected due to fast-forwards

I keep getting the following fail with heroku + git...

$ heroku jammit:deploy --app XXXXXXXXXXX
===== Compiling assets...[OK]
===== Commiting assets...[OK]
===== Done...
===== Deploying assets for xxxxx-staging to heroku...
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to ''
To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes (e.g. 'git pull') before pushing again. See the
'Note about fast-forwards' section of 'git push --help' for details.
===== Done...
===== Deleting compiled assets...[OK]
===== Commiting deleted assets...[OK]
===== Done...
$ git pull
Already up-to-date.

Any ideas what I'm doing wrong or should be doing differently to allow for pushing without having to force a push?



Just force the commit every time you push and it will push it even if there are fast-forward commits. We do this in our development Heroku server all the time since we're all pushing different commits (some further behind than others).

git push -f

I don't use jammit for deploying, but you could probably get away with force pushing first and then running the jammit task second. Or check and see if jammit supports a force push flag of some sort.