Olivier Lacan Olivier Lacan - 1 year ago 115
Git Question

How can I deploy/push only a subdirectory of my git repo to Heroku?

I have a project that uses Serve and is version controlled using Git. Serve creates an

folder with static files that I want to deploy to Heroku.

I don't want to deploy the Serve project itself since the Heroku Cedar stack doesn't seem too fond of it, but most importantly I want to take advantage of Heroku's great support for static websites.

Is there a way to deploy a subfolder to a git remote?
Should I create a Git repo in the
folder (that sounds wrong) and push that to Heroku?

Answer Source

There's an even easier way via git-subtree. Assuming you want to push your folder 'output' as the root to Heroku, you can do:

git subtree push --prefix output heroku master

It appears currently that git-subtree is being included into git-core, but I don't know if that version of git-core has been released yet.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download