Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git Errors when Pushing on Heroku

I'm using Heroku and have a Rails app that is stable (production env), so I wanted to create something new where I can have quality assurance env where I can see how the changes will work on Heroku (as well as aggregating enhancements for releases) without always pushing to my production app.

So what I did was create a new Heroku app, and also create a new branch locally (dev). My intention was to merge dev into master locally after I tested the change on my new Heroku QA app, and then push to Heroku production from my master branch.

My approach might be a bad one with my landscape, I'm a newbie, so this was just my best guess at how to do this.

But when I pushed my dev branch to my new QA app, it worked for pushing to a dev branch of the QA app, but not the master. So I couldn't see (and test) my changes on the new QA app. It seems to be telling me that I can only push the master branch to the master of my QA app, since I pulled already and everything was already up-to-date, but I receive this error:

Pushing to [email protected]:foobar/QA.git
To [email protected]:foobar/QA.git
! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to '[email protected]:foobar/QA.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Merge the remote changes (e.g. 'git pull')
hint: before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

Can someone please help me figure out what I'm doing wrong - either with my environments or with Git? Thank you.

like image 628
yellowreign Avatar asked Jun 08 '12 20:06

yellowreign


1 Answers

Try pushing with the -ff (fast-forward) option: git push heroku master -ff (replace heroku with the actual name of heroku remote).

like image 83
Gosha A Avatar answered Sep 27 '22 23:09

Gosha A