svn 遷移到git
1.物理環境
Git–server Centos5.8 192.168.1.245 Svn–server Centos5.8 192.168.1.108
2.建立SVN使用者到git使用者的對映檔案
建立SVN使用者到git使用者的對映檔案,檔案格式如下:
cat /tmp/userinfo.txt david=sfzhang yanni=yanni
3.克隆一個git版本庫
透過git svn clone克隆一個git版本庫,SVN裡面包含trunk,branches和tags。
git svn clone svn://192.168.1.108:9999/yanzi/ --no-metadata --authors-file=userinfo.txt --trunk=trunkmobile --tags=tags --branches=branches --ignore-refs=refs/remotes/yanzi-.* yanzi
引數–no-metadata表示:阻止git匯出SVN包含的一些無用資訊
引數–authors-file表示:SVN賬號對映到git賬號檔案,所有svn作者都要做對映
引數–trunkmobile表示:主開發專案
引數–branches表示:分支專案,--ignore-refs表示不包含後面的分支專案
引數yanzi表示:git專案名稱
4.檢視專案提交的歷史記錄
透過git log 檢視專案提交的歷史記錄,包括作者,日照,和提交註釋資訊等。
cd yanzi git log commit 3c4907782804096ea3fa3fb5419dcce610e56f1f Author: david Date: Fri May 10 10:27:50 2013 +0000
5.列出當前所有的分支
cd yanzi git branch -r tags/mobile_1.0.0 tags/mobile_1.0.1 trunk yanziios1.0.1-build-2223-branch-002
6.手動將branches分支轉換為tags
git tag mobile_1.0.0 tags/mobile_1.0.0 git tag mobile_1.0.1 tags/mobile_1.0.1
7.將多餘的branches刪除掉
git branch -r -d tags/mobile_1.0.0 Deleted remote branch tags/mobile_1.0.0 (was d50002b). git branch -r -d tags/mobile_1.0.1 Deleted remote branch tags/mobile_1.0.1 (was e7b78a2).
8.再次列出當前的所有分支
git branch -r trunk yanziios1.0.1-build-2223-branch-002
9.建立git倉庫並初始化版本庫
mkdir -p /data/gitdata/yanziios.git cd /data/gitdata/yanziios.git/ git init --bare Initialized empty Git repository in /data/gitdata/yanziios.git/
10.將yanziios.git的屬主修改為git使用者
chown git yanziios.git -R ls -l yanziios.git/ total 64 drwxr-xr-x 2 git root 4096 May 22 12:25 branches -rw-r--r-- 1 git root 66 May 22 12:25 config -rw-r--r-- 1 git root 73 May 22 12:25 description -rw-r--r-- 1 git root 23 May 22 12:25 HEAD drwxr-xr-x 2 git root 4096 May 22 12:25 hooks drwxr-xr-x 2 git root 4096 May 22 12:25 info drwxr-xr-x 4 git root 4096 May 22 12:25 objects drwxr-xr-x 4 git root 4096 May 22 12:25 refs
11.新增遠端git伺服器地址
git remote add origin [email protected]:/data/gitdata/yanziios.git
12.推送全部的分支和標籤資訊到git伺服器上
git push origin master --tags
之後就是SVN遷移到Git測試,在客戶端用SourceTree工具克隆一個Git服務端倉庫yanziios.git,在SourceTree圖形介面裡面可以看到git使用者提交的Graph資訊,描述資訊(Description),日期,作者和版本號等資訊。
|
相關知識連結: |
原文來自:
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/69955379/viewspace-2906344/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 大家使用git是敲命令還是用GUI工具呢
- 工作中使用 Git 解決問題的場景
- 如何參與開源專案 - 細說 GitHub 上的 PR 全過程
- 『現學現忘』Git後悔藥 — 30、版本回退git reset --hard命令說明
- 基於 Github Actions 自動部署 Hexo 部落格
- GitHub 四宗罪“惹眾怒”?SFC 發文《Give Up GitHub!》呼籲全網聲討
- 『現學現忘』Git後悔藥 — 31、reset版本回退命令總結
- Boz Digital Labs Little Clipper for Mac(動態修剪效果器外掛)
- DigiTimes:預計2022年主機板銷量將下跌30% 廠商或準備進入艱難時期
- github package的使用教程
- 揭開周獲 18k star 開源專案的神祕面紗「GitHub 熱點速覽 v.22.28」
- 動態修剪效果器外掛:Boz Digital Labs Little Clipper for Mac
- Digital Turbine對Fyber和AdColony的業務整合已經完成
- 螢幕截圖工具Snagit 2022 mac
- 正式釋出丨AKS上的Dapr、ML、Gitops擴充套件
- GitHub倉庫配置SSH keys步驟流程圖解
- 什麼新東西值得學「GitHub 熱點速覽 v.22.29」
- 如何在spring boot 使用 gitlab的Api