Search code examples
githeroku

How can I push a part of my git repo to Heroku?


I have a multi-module app that is already on Github. It is comprised of two modules, one of them an Android app and the other a Rails based Web app. So my project's directory structure is in the form of:

ProjectRoot
|
+-- web
|
+-- android
|
+-- .git

As such I cannot simply cd into ProjectRoot and push my app to Heroku as the root folder of the Rails app is ProjectRoot/web. Is there a way to push the web folder to Heroku? If I turn web into a git sub module, it should be easy to accomplish this, but then I only have 5 private repos on Git and I prefer to consume only 1 repo for my whole app.


Solution

  • You can use git subtree push. It will generate a new commit tree with your directory as root, and push it.

    git subtree push --prefix web heroku master
    

    Full documentation is here.