Using Github and Heroku Together
Posted: May 28th, 2010 | Author: mindtonic | Filed under: Git | Tags: git, Github, Heroku | No Comments »From: http://www.mail-archive.com/heroku@googlegroups.com/msg00350.html
Can I get suggestions on how to move my app from GitHub to Heroku and back?
You can do this if you’re using git locally. The magic of
decentralized revision control makes it possible, since every checkout
is a full repository in its own right. What I suggest is adding two
different remotes to your local checkout, and then you can push to
both. Something like this:
git remote add github [EMAIL PROTECTED]:myaccount/myapp.git
git remote add heroku [EMAIL PROTECTED]:myapp.git
Then you can do “git push heroku” and “git push github”, or pull, or
diff, or whatever. You could also name one origin, which will make it
the default, but it would probably lead to less confusion if you had
to explicitly name where you wanted to push or pull from each time.
In my specific case, I am already hosting my codebase on Github. I want to keep the main repository there because I like all of the available features. I also want to be able to work with collaborators and allow them to make commits to the master Github repository.
Heroku is amazing, but when you push to the Heroku repository it automatically restarts the application. Using these methods, I can maintain a situation where one person is able to manage what actually goes “live” to Heroku, while everyone else can work away on Github using the normal collaboration procedures.
Result, the best of both worlds!
Leave a Reply