公开存储库的一个子集,同时保留历史记录 [英] Making a subset of a repository publicly available, whilst keeping history

查看:38
本文介绍了公开存储库的一个子集,同时保留历史记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些受版本控制的代码(使用 mercurial),我想分享其中的一些,同时隐藏我无法发布到公共领域的其他部分(至少在现阶段).

I've got some code under version control (using mercurial), and would like to share some of it, whilst hiding other parts which I cannot release into the public domain (at least at this stage).

我希望保持公共代码的修订历史完整无缺,更重要的是,能够在公共存储库和包含公共和私有代码的存储库之间推送/拉取更改.但是,应该无法从公共存储库历史记录中恢复任何私人信息.

I'd ideally like to keep the revision history of the public code intact, and, more importantly, be able push/pull changes between the public repository and the repository containing both public and private code. It should not, however, be possible to recover any of the private info from the public repository history.

从我目前收集到的信息来看,应该可以使用 提取公共内容hg convert 使用 filemap 并排除,尽管这会更改所有修订 ID 并排除两个存储库之间的任何交互.

From what I've gleaned so far, it should be possible to extract the public stuff using hg convert with a filemap and excludes, although this would change all the revision ids and preclude any interaction between the two repositories.

为了完整起见,我想我应该补充一点,该存储库最初是从 cvs 转换而来的.

For completeness I guess I should add that the repository was originally converted from cvs.

如有任何想法,将不胜感激,

Would be grateful for any ideas,

推荐答案

这并不总是实用,但如果你的 repo 的公共部分可以限制(或移动到)你当前 repo 的子目录,那么你可以:

It is not always practical, but if the public part of your repo can be limited (or move to) to a subdirectory of your current repo, then you could:

  • 提取(例如,像你提到的,hg convert) 该子目录在它自己的 repo 中
  • 将该新存储库引用为子存储库 用于您的主要存储库.

然后您将管理两个存储库:

You would then manage two repos:

  • 一个公开(只有公开文件)
  • 一个私有的(引用公共仓库作为子仓库)

这篇关于公开存储库的一个子集,同时保留历史记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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