9

svn仓转git仓

 3 years ago
source link: http://quangelab.com/svn2git/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

SVN的标准目录结构:trunk、branches、tags

我们在一些著名开源项目的版本库中,通常可以看到trunk, branches, tags等三个目录。由于SVN固有的特点,目录在SVN中并没有特别的意义,但是这三个目录却在大多数开源项目中存在,这是因为这三个目录反映了软件开发的通常模式。

trunk是主分支,是日常开发进行的地方。

branches是分支。一些阶段性的release版本,这些版本是可以继续进行开发和维护的,则放在branches目录中。又比如为不同用户客制化的版本,也可以放在分支中进行开发。

tags目录一般是只读的,这里存储阶段性的发布版本,只是作为一个里程碑的版本进行存档。

要使用这样的文件夹结构,在建立项目版本库时,可首先建好项目文件夹,并在其中建立trunk, branches, tags三个空的子目录,再将项目文件夹连同这三个子目录一起导入版本库。

这样在trunk中开始进行开发,当需要建立branch或tag时,使用SVN的copy操作进行。

其中tags目录需要只读,可以使用SVN中的authz文件控制该目录的访问权限为只读。

在实现上,branch和tag,对于svn都是使用copy实现的,所以他们在默认的权限上和一般的目录没有区别。至于何时用tag,何时用branch,完全由人主观的根据规范和需要来选择,而不是强制的(比如cvs)。

开源库:http://anonsvn.jboss.org/repos/jbossas/ http://anonsvn.jboss.org/repos/hibernate/ http://shelves.googlecode.com/svn/ http://hustoj.googlecode.com/svn/ http://zxing.googlecode.com/svn/ http://swiftp.googlecode.com/svn/ http://acra.googlecode.com/svn/

SVN 服务器搭建

ubuntu下需要手动安装 svn

sudo apt install subversion

mac 已经预装了。

//创建svn服务器
svnadmin create /Volumes/ext/svnserver/mycode  
//进入该目录修改服务器配置
cd /Volumes/ext/svnserver/mycode

vi svnserve.conf
anon-access = none
auth-access = write
password-db = passwd
authz-db = authz

vi passwd
[users]
zrq = 456
lgz = 456

vi authz
[groups]
dev = zrq,lgz
# harry_sally_and_joe = harry,sally,&joe

[/]
@dev = rw

上面已经配置好了,下面启动

svnserve -d -r /Volumes/ext/svnserver
svn import /Volumes/ext/svnimport/weibo svn://localhost/mycode/weibo --username=zrq --password=456 -m "fuck"

从svn服务器checkout 并修改

svn checkout  svn://localhost/mycode/weibo --username=zrq --password=123 /Users/zhangruquan/Documents/code/weibo

做一些修改后 提交到服务器

cd /Users/zhangruquan/Documents/code/weibo

svn log
svn commit -m "修改了readme"
svn update
svn copy svn://localhost/mycode/weibo/trunk svn://localhost/mycode/weibo/branches/develop -m ‘创建develop分支’

SVN转Git

ubuntu 需要安装,mac自带

sudo apt-get install git-svn

svn2git的安装

sudo gem install svn2git

转换上面自己搭建的服务器 并提交到git服务器上

cd /Volumes/ext/svn2git/weibo 
yes 456 | svn2git svn://192.168.5.24/mycode/weibo --username zrq
//不带密码 svn2git svn://192.168.5.24/mycode/weibo
cd /Volumes/ext/svn2git/weibo

git remote add origin [email protected]:woashizhangsi/trysvn.git
git push -u origin master -f

git push --tags 

git add .

git branch 

//cheout 某个分支并提交
git checkout *

git push -u origin * -f

git克隆私仓stackoverflow原文

git clone https://username:[email protected]/github_34949402/testprivate.git

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK