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?
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.
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
- Go to the following section
Deploy
in your app's configuration page - For
Deployment method
, clickGitHub
- For
App connected to GitHub
, select and connect your repo
Automatic deploys
- Go to the following section
Deploy
>Automatic deploys
in your app's configuration page - Verify/select your desired branch
- Optionally click
Wait for CI to pass before deploy
- Click
Enable Automatic Deploys
Manual deploys
- Go to the following section
Deploy
>Manual deploys
in your app's configuration page - Verify/select your desired branch
- Click
Deploy Branch
Screenshot
Here's a screenshot to show the UI:
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.
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
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.
© 2022 - 2024 — McMap. All rights reserved.