Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

git

heroku

I have a project that uses Serve and is version controlled using Git. Serve creates an output 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 output folder (that sounds wrong) and push that to Heroku?

like image 716
Olivier Lacan Avatar asked Oct 19 '22 20:10

Olivier Lacan


1 Answers

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.

like image 249
anshumans Avatar answered Oct 22 '22 09:10

anshumans