0

I am trying to use this tutorial https://medium.com/@sagarjauhari/quick-n-clean-way-to-deploy-vue-webpack-apps-on-heroku-b522d3904bc8 so that I only push the dist folder to heroku. I am using the following code:

"deploy": "git subtree push --prefix dist heroku master"

so when I am satisfied with my changes that i have made locally, i do the following.

npm run build 
git add -A
git commit -m "message"
git push
npm run deploy 

then i get an error message that reads:

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

What am I doing wrong? If I run git push heroku at this point, it works fine.

Timmy Von Heiss
  • 2,160
  • 17
  • 39

1 Answers1

1

For a quick (and potentially destructive) fix, you can force the subtree to push. Note that this will destroy any data on Heroku that you don't have locally, and you canot undo this change.

To do this, run the following command:

git push heroku `git subtree split --prefix dist master`:master --force

and run npm run deploy again.

Please let me know if that helps.

Referenced:

How do I force a subtree push to overwrite remote changes? and http://clontz.org/blog/2014/05/08/git-subtree-push-for-deployment/

steve
  • 352
  • 3
  • 11