[git/hg]什么叫做bare repo?
hg管理的repo天生就能做codebase使用,无论是否是bare的,这点是由其分布式版本控制系统的本质决定的,它可以随时把当前的repo通过自带的http server发布代码,特别适合分布式开源项目的代码分享。
git也是分布式代码版本管理工具,不过它对作为codebase的repo做了严格的bare要求。可以看到的是许多人在初学git时不了解这一点,抱怨自己做spike时不知如何提交代码到在本机上的codebase。这里顺手写下两个tips:
* 初始建立一个bare repo
$ git init --bare
* 如果已有一个repo了,使用下面的方法将其转化为bare的
$ git config --bool core.bare true
之后可删除除了repo根目录.git文件夹之外的所有文件,即只保留专用目录
摘自: git vs hg - 挖金子的矿工 - 博客频道 - CSDN.NET
补充:
1. 上面部分说法可能不对,因为该博文是针对老版hg写的,而后来hg也有了类似git的repo内多命名分支,而对于bare repo,官方wiki (GitConcepts#Bare_repositories上)说要这样: hg update null
2. 对git而言, bare repo不仅仅是没有checkout, 而且There is no .git directory is created. Instead, the files normally in the .git directory are placed in the top-level directory where the working directory would normally be. (来自Shared Repositories Should Be Bare Repositories - GitGuys)