我想将旧的 CVS 存储库迁移到 git,同时保留历史记录。
以下是我在CVS中查看需要迁移的5个分支的方法:
branch1:
cvs co -r branch1 sim Login SystemMonitor archiver
branch2:
cvs co -r branch2 par sim Login archiver
cvs co -r branch2_redux editor
branch3:
cvs co -r GEN3 par sim SystemMonitor archiver
cvs co -r GEN3_update1 tms editor
cvs co -r GEN3Sim
...
所以这里的问题是单个分支指定:
我不是专家,但它似乎太灵活了,无法适应 git,因为你只能一次检查一个分支/标签。
我想要的是:
这可以实现吗?如果可以,如何实现?
我已经尝试过的 我在存储库上成功运行了 cvs2git(非常长的 10 个小时)。我最终得到了像branch1、branch2、branch2_redux、GEN3、GEN3_update1、GEN3Sim(-r标志)这样的分支。但是,我不确定如何将 GEN3+GEN3_update1+GEN3Sim 的历史记录和文件合并到单个分支3中。
这是我用来转换仓库的命令:
cd ~
rsync -avz myusername@cvsserver:/path/to/cvsrepo/ ./cvsrepo_local_copy/
cvs2git --blobfile=~/git-blob.dat --dumpfile=~/git-dump.dat --username=cvs2git ~/cvsrepo_local_copy
mkdir new_git_repo && cd new_git_repo && git init
cat ~/git-{blob,dump}.dat | git fast-import
我建议首先修改 CVS 存储库(副本),然后然后运行 cvs2git。
,v
文件只是文本文件,没有校验和或任何内容,因此您可以直接编辑它们。
类似这样的事情,为您想要标准化为基本分支名称的所有分支完成。
find editor -type f -name '*,v' | xargs sed -i -e 's/branch2_redux/branch2/g'