Joerg Viola

Lean. Web. Development.

Don't Use Amend With Heroku

I forgot to add a new file in a git commit (since I did not refresh my eclipse workspace). That caused a little surprise on the next release.

When trying to release to heroku the next time, I was told:

1
2
3
4
5
6
7
$ git push test master
To git@heroku.com:test-66and33.git
 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'git@heroku.com:test-66and33.git'
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.

I learned from Stackoverflow that after amending a commit, you have to force the next push:

1
$ git push test master --force

Conclusion from SO: Don’t amend!

Comments