Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to update an Heroku App created using GitHub "Deploy to Heroku" button?

I've created an app using a GitHub 'Deploy to Heroku' button. Since the git project has changed, how to update my existing instance with new upstream commits?

like image 643
dcoeurjo Avatar asked Feb 26 '15 08:02

dcoeurjo


3 Answers

Heroku's web console can also do this easily. Connect your app to the GitHub repo to deploy automatically or manually from the selected git branch. Automatic deploys can also wait till CI passes. Use the following steps to configure your project.

Setup

  1. Go to the following section Deploy in your app's configuration page
  2. For Deployment method, click GitHub
  3. For App connected to GitHub, select and connect your repo

Automatic deploys

  1. Go to the following section Deploy > Automatic deploys in your app's configuration page
  2. Verify/select your desired branch
  3. Optionally click Wait for CI to pass before deploy
  4. Click Enable Automatic Deploys

Manual deploys

  1. Go to the following section Deploy > Manual deploys in your app's configuration page
  2. Verify/select your desired branch
  3. Click Deploy Branch

Screenshot

Here's a screenshot to show the UI:

enter image description here

Note: as mentioned by Tim Malone, this only works with your own repos, but this can be addressed by creating a fork as mentioned by Skyost.

like image 78
Grokify Avatar answered Sep 21 '22 16:09

Grokify


I went and grabbed the original repo and then force pushed it onto my app in Heroku. Looks like this:

git clone https://github.com/USER/REPO.git
git checkout v0.7.3
git remote add heroku https://git.heroku.com/APP-NAME.git
git push -f heroku master

Heroku makes it easy to clone the repo for you app using

heroku git:clone -a app-name

I originally tried doing that and then adding the original repo as a remote and merging changes, but I ran into some trouble which I didn't feel like figuring out.

like image 24
jrjohnson Avatar answered Sep 24 '22 16:09

jrjohnson


Here's a way to do it if you already have the app cloned or if you want to clone from Heroku first.

# Clone app if you haven't already
heroku git:clone -a appname
# Get latest app
git remote add REPO https://github.com/USER/REPO.git
git branch -b REPO REPO/master
# Delete master
git branch -D master
# Remake it with latest
git checkout -b master
# And force push it to heroku
git push -f heroku master
like image 34
Travis Reeder Avatar answered Sep 24 '22 16:09

Travis Reeder