简体   繁体   English

重用来自另一个开源项目的一小部分文件的最佳方法?

[英]Best way to reuse just a small set of files from another Open-Source project?

image that another Open-Source project on Github provides some parts that I would like to reuse in my project, like图片 Github 上的另一个开源项目提供了一些我想在我的项目中重用的部分,比如

  • a few stylesheets,一些样式表,
  • a CSS,一个 CSS,
  • a small module, or一个小模块,或
  • a LaTeX template. LaTeX 模板。

All I need is a small subset of the other project.我所需要的只是另一个项目的一小部分。 Often the scope and functionality of the other project is very far from mine.通常 scope 和其他项目的功能离我很远。

What will be the best way to organize this from a practical (assuming the legal perspective is covered by the existing license)?从实际情况来看,最好的组织方式是什么(假设现有许可证涵盖法律角度)? Ideally, merging improvements from the upstream repository and sending pull requests for local improvements I create back to the original project would remain possible.理想情况下,合并来自上游存储库的改进并将我创建的本地改进的拉取请求发送回原始项目仍然是可能的。

a) I could add the other Github repository to the requirements.txt of my project, install it and optionally delete all the parts that I do not need after installation in my installation procedure (setup.py etc.). a) 我可以将另一个 Github 存储库添加到我的项目的 requirements.txt 中,安装它并在我的安装过程(setup.py 等)中删除安装后我不需要的所有部分。 b) I could fork the other Github repository, reduce my fork thereof to the files I need, and add my fork to the requirements of my new project. b) 我可以 fork 另一个 Github 存储库,将我的 fork 减少到我需要的文件,并将我的 fork 添加到我的新项目的要求中。

I found Linking a single file from another git repository , but his does not really address my needs.我发现Linking a single file from another git repository ,但他并没有真正满足我的需求。

Of course, it is risky to establish a rigid link to the internal organization of another project.当然,与另一个项目的内部组织建立刚性联系是有风险的。 But that is not the issue in here.但这不是这里的问题。

Any ideas?有任何想法吗?

If you really need to keep a strong link between some files of a repository and your own project repo, I would:如果您确实需要在存储库的某些文件和您自己的项目存储库之间保持强大的链接,我会:

  • add a fork of the first repository as a submodule inside my own project repository在我自己的项目存储库中添加第一个存储库的分支作为子模块
  • use symlinks inside my project for the few files I need (symlink to the submodule required file)在我的项目中为我需要的几个文件使用符号链接(到子模块所需文件的符号链接)

That way:那样:

  • I can use those files anywhere inside my project我可以在项目中的任何地方使用这些文件
  • each time I modify them, I actually change their content in the submodule repository, which makes it easier to identify the change, and make a pull request每次我修改它们时,我实际上都会在子模块存储库中更改它们的内容,这样更容易识别更改并发出拉取请求

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 从压缩的开源 GitHub 下载编译 Xcode 项目 - Compiling Xcode project from zipped open-source GitHub download 在(上游)开源项目之上维护其他功能 - Maintaining additional features on top of an (upstream) open-source project 如何使用源代码管理管理同一项目的开源和商业版本? - How do I manage an open-source and commercial version of the same project using source control? 工作流程:git 带有功能分支、变基、拉取请求(非开源项目) - Workflow: git with feature branches, rebase, pull requests (not open-source project) 如何继续为开源项目做出贡献? - How to continue contributing to open-source projets? 开源项目中 gitflow 的最佳实践 - Best practices for gitflow in an open source project 当没有jar文件可用时,将另一个开源项目集成到Android项目中的规范方法是什么? - What is the canonical way to integrate another open source project into an Android project when no jar file is available? 使我的存储库中的文件与 github 上的开源文件同步的最佳方法是什么? - What is the best way to keep a file from my repo synced with an open source file on github? 如何更新开源代码的修改版本? - How to update a modified version of an open-source code? 解决开放源代码项目中的错误,发出或请求请求的正确方法? - The right way to resolve a bug in an open source project, issue or pull request?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM