一个目录(同一级别)中的多个存储库 - 可能吗? [英] Multiple repositories in one directory (same level) - is it possible?

查看:21
本文介绍了一个目录(同一级别)中的多个存储库 - 可能吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我原来的问题是我有一个目录,我可以在其中编写各种脚本.它们中的每一个都独立于其他文件,通常是一个文件长.我想对它们应用一些版本控制,但我有以下问题/要求:

My original problem is that I have a directory where I write various scripts. Each of them is independent of others, and usually one-file-long. I want to have some versioning applied to them, but I have the following problems/requirements:

  1. 不想必须将每个小脚本存储在一个单独的目录中!立>
  2. 不想将它们全部存储在一个存储库OTOH中,因为它们完全不相关, 和:
    • 其中一些可能会在以后增长为更多文件(然后他们将需要一个单独的目录),
    • 有时我想将其中一个复制到另一台机器上(我想克隆整个存储库).
  1. I don't want to have to store each small script in a separate directory!
  2. I don't want to store them all in one repository OTOH, as they are completely unrelated, and:
    • some of them may later grow to more files (and then they will need a separate dir),
    • I sometimes want to copy one of them to a different machine (and I want to clone the whole repo).
  • 无限"的修订次数,
  • 能够在不同的计算机上克隆存储库,
  • 能够执行原子"多文件提交.

有可能吗?
我更喜欢在一些主流的分布式 VCS 中进行(使用 Mercurial 的解决方案会更好,但我不是固定的).

Is it possible?
I'd prefer to do it in some mainstream distributed VCS (a solution using Mercurial would be preferable, but I'm not fixed).

解决方案必须是免费的(至少就像啤酒一样")和跨平台的(至少是 Win32 和 Linux).

the solution has to be free (at least "as in beer") and cross-platform (at least Win32 & Linux).

  • "two-git-repositories-in-one-directory" -- didn't find it helpful: the accepted answer looks like point 2. (above) to me; the current "community voted" answer sounds like 1.
  • "Version control of single files using Subversion" -- also too much of 2. or 1.

推荐答案

更新(2016 年): 显然,一个名叫 Cosmin Apreutesei 的人创建了一个名为 multigit,这似乎实现了我在这个问题中的愿望!如果你读过它,非常感谢 Cosmin!我今年开始使用你的工具,并发现它很棒.

UPDATE (2016): Apparently, a guy named Cosmin Apreutesei created a tool named multigit, which seems to implement what I wished for in this question! If you ever read it, thanks a lot Cosmin! I've started using your tool this year and find it awesome.

<小时>

我开始考虑在 Mercurial/git/... 上进行某种覆盖,这将保留几个禁用"的存储库元目录,比方说:


I'm starting to think of some kind of an overlay over Mercurial/git/... which would keep a couple "disabled" repository meta-directories, let's say:

.hg1/
.hg2/
.hg3/

等,然后在 hg commit FILENAME 上会找到链接到 FILENAME 的特定 .hgN,然后临时:

etc., and then on hg commit FILENAME would find the particular .hgN that is linked to FILENAME, and would then temporarily:

mv .hgN .hg
hg commit FILENAME
mv .hg .hgN

主要缺点是需要我花一些时间来编写工具.或者有人知道这样的现成的吗?如果您这样做了,请将其作为功能齐全的答案(不是评论)发布,我非常愿意接受.

The main disadvantage is that it would require me to spend some time writing the tool. Or does anybody know of some ready-made one like this? If you do, please post as a full-featured answer (not a comment), I'm more than willing to accept it.

这篇关于一个目录(同一级别)中的多个存储库 - 可能吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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