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

4

12

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?

Sanmiguel answered 26/2, 2015 at 8:25 Comment(0)
A
7

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.

Augusto answered 15/12, 2015 at 4:49 Comment(0)
F
3

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.

Freewheel answered 29/5, 2018 at 8:59 Comment(2)
The only problem with this is if you have deployed someone else’s app - which is often what the Deploy to Heroku button is used for.Mitten
@TimMalone You only have to create a fork of the repository you want to deploy.Dianthe
P
1

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
Prissie answered 22/8, 2016 at 20:8 Comment(0)
C
0

Assuming your local branch is called master you could try:

git pull heroku master

Keep in mind that you may have merge conflicts if your local branch and the remote have diverged. This also assumes that you have configured heroku to point to the appropriate place in the repo.

Cartomancy answered 26/2, 2015 at 8:40 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.