如何仅将 git repo 的子目录部署/推送到 Heroku? [英] How can I deploy/push only a subdirectory of my git repo to Heroku?

查看:19
本文介绍了如何仅将 git repo 的子目录部署/推送到 Heroku?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用 Serve 的项目,并且使用 Git 进行版本控制.Serve 创建一个 output 文件夹,其中包含我想要部署到 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.

我不想部署 Serve 项目本身,因为 Heroku Cedar 堆栈似乎不太喜欢它,但最重要的是,我想利用 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.

有没有办法将子文件夹部署到 git 远程?我应该在 output 文件夹中创建一个 Git 存储库(这听起来不对)并将其推送到 Heroku?

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?

推荐答案

通过 git-subtree.假设您想将文件夹输出"作为根目录推送到 Heroku,您可以执行以下操作:

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

目前似乎 git-subtree 已被包含到 git-core 中,但我不知道该版本的 git-core 是否已经发布.

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.

这篇关于如何仅将 git repo 的子目录部署/推送到 Heroku?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆