我应该使用几个存储库来在版本控制下维护我的脚本? [英] How many repositories should I use to maintain my scripts under version control?

查看:74
本文介绍了我应该使用几个存储库来在版本控制下维护我的脚本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我主要为自己编写小程序,但是最近,我开始为团队中的同伴编写代码.为此,我开始使用Mercurial存储库以某种形式的版本控制(特别是Windows上的Tortoise-Hg)维护代码.我有许多小脚本,每个小脚本都位于一个单独的目录中,都位于一个存储库中.但是,在阅读 Joel的Hg教程时,我尝试为其中一个较大的脚本克隆目录以创建稳定"目录.版本,发现我无法执行此操作,因为该目录本身不是存储库.

I mainly code small programs for myself, but recently, I've been starting to code for my peers on my team. To that end, I've started using a Mercurial repository to maintain my code in some form of version control (specifically, Tortoise-Hg on Windows). I have many small scripts, each in their own directory, all under one repository. However, while reading Joel's Hg Tutorial, I tried cloning a directory for one of my bigger scripts to create a "stable" version and found I couldn't do it because the directory wasn't itself a repository.

因此,我假设(如果我弄错了,请更正我)为了正确使用克隆,我必须为每个脚本/目录创建一个存储库.但是..这会是一个好主意"还是未来的维护梦waiting呢?

So, I assume (and please correct me if I'm mistaken) that in order to use cloning properly, I'd have to create a repository for each script/directory. But.. would that be a "good idea" or a future maintenance nightmare waiting to happen?

简而言之,我是否将所有(不相关的)脚本保存在一个存储库中,还是应该为每个脚本创建一个存储库?还是一些未知的第三种选择?

Succinctly, do I keep all my (unrelated) scripts in one repository, or should I create a repository for each? Or some unknown third option?

推荐答案

对于可能要在某个时候独立使用的所有内容,请使用单独的存储库.将来合并回购协议非常容易,而将它们拆散则要困难得多. subrepos 功能(如svn外部组件)甚至可以使您制作一个包含所有小版本的伞式仓库.如果您仍然希望在单个命令中进行克隆,请回购.

Use separate repos for everything that you might want to use independently at some point. It's very easy to combine repos in the future and much harder to pull them apart. The subrepos feature (like svn externals) even lets you make an umbrella repo that includes all the small repos if that's still something you'd like to be able to clone in a single command.

这篇关于我应该使用几个存储库来在版本控制下维护我的脚本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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