Deploying a git subtree to Heroku (or other PaaS)

Most of the common PaaS platforms like OpenShift and Heroku deploy code based on a source in a git repo – you push your local repo containing source to the remote repo on the platform, the build is performed remotely and then deploys the built artifacts.

What if you want to deploy an app that is prebuilt, or you have a git repo that contains various subfolders, and only part of the folder structure in the repo is what you need deployed?

I’ve been experimenting with a simple React app that also has a node.js backend. In hindsight restructuring the source tree to make the app easier to deploy may have been simpler, but it turns out you can push part of your source subtree to a remote repo, like an application deployed to Heroku, using ‘git subtree’:

git subtree push –prefix subfoldername heroku master

This is discussed in this post here.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.