How can I deploy old commits to Heroku
We’re trying to deploy a big Rails project to Heroku for the first time, but something’s breaking during the Heroku compilation process and we have no way of knowing what.
So now we’re going to plan B, which is to walk up the commit chain and test deploy each step of the way against Heroku until we figure out at which point it becomes un-compileable. (Yea, it’s the best I could come up with at this point.)
- git error while deploying through chef
- What is the best workflow for updating / deploying a Rails app through Git?
- How do I use git to manage a codebase with separate client assets?
- How to overwrite local files with a specific Heroku release version?
- Developing & deploying Rails app from same machine
- Private Github repositories in dockerized rails application during build
So I figured I’d just clone the project locally, checkout some old commits, and push to heroku. But then I discovered that if I push to heroku from anything but master, it doesn’t build the app?? Instead it says: “Pushed to non-master branch, skipping build.”
So now even my bad plan is a non-starter. I’m just looking for a break here. Any ideas on how to do what im trying to do?
2 Solutions collect form web for “How can I deploy old commits to Heroku”
It’s not that Heroku only builds if you push from master, rather Heroku will only build if you push to master. If you just do
git push heroku
then you are probably pushing your local branch to one with the same name on Heroku (the exact default behaviour is configurable). You can push from a different local branch to Heroku master with
git push heroku my_local_branch:master
or, if you are already checked out on
my_local_branch you could use
git push heroku HEAD:master
See the documentation for
git push – the examples towards the end in particular may help.
You will probably also need to use
-f to force the push:
git push -f heroku my_local_branch:master
It’s a lot easier to achieve the desired result with heroku instead of the multi-step git process of checking in code, and pushing it. This keeps your git history clean.
$ heroku releases $ heroku rollback v11