我有哪些合并存储库子集的选项? [英] What are my options for merging subsets of repositories?

查看:24
本文介绍了我有哪些合并存储库子集的选项?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这个问题更像是一个应用程序架构和源代码控制类型的问题.

This question is more of an application architecture and source control type of question.

我有 2 个 Github 存储库,一个是 React 单页应用程序,另一个用于 React 网站.对于我的单页应用程序,我将代码公开,并将应用程序链接到其存储库.对于我的网站,我希望将存储库保密,但将单页应用程序合并到其中,以便人们无需下载和构建代码即可使用它.

I have 2 Github repositories, one is a React single page application and the other is for a React website. For my single page application, I am making the code publicly available and the application links to its repository. For my website, I want to keep the repository private but incorporate the single page application into it so people can use it without having to download and build code.

我能否获得一些关于如何将单页应用程序存储库的更改与网站存储库合并的选项?

到目前为止,我只是通过复制代码并推送代码来手动将代码合并到网站,但这是一种有问题的做事方式.两个 repo 都还没有完全启动并运行,所以我还有时间进行架构更改.也许有 git 命令可以处理所有事情?

So far I am just merging code to the website manually by copying it over and pushing the code, but that is a problematic way of doing things. Neither repo is completely up and running yet, so there is still time for me to make architecture changes. Maybe there are git commands to handle everything?

感谢任何帮助,包括建议的架构/存储库更改.

Any help is appreciated, including suggested architecture/repo changes.

推荐答案

我认为这里最好的选择是使用 git cherry-pick,但是以一种自动化的方式:

I think the best option here would be to use git cherry-pick, but in an automated way:

  • 构建一个简单的脚本来监听 通过 git webhooks 推送事件,来自您的单页存储库.这样你就可以自动获得合并主事件
  • 获取该提交的哈希值
  • 将该哈希值插入到应用于您的私人网站存储库的 git cherry-pick 命令中.您可以将此提交应用到此 repo 中的单独分支上,并在您认为合适时将其合并到 master 中
  • Build a simple script that listens for push events via git webhooks, from your single page repo. That way you can get the merge-in-master event automatically
  • Get the hash of that commit
  • Plug that hash into the git cherry-pick command applied on your private website repo. You can apply this commit on a separate branch in this repo, and merge it in master when you think it's appropriate

这篇关于我有哪些合并存储库子集的选项?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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