Migration From Subversion(svn) to Git

migration from subversion(svn) to git

git officiall documents
https://git-scm.com/docs/git-svn
https://git-scm.com/book/en/v2/Git-and-Other-Systems-Migrating-to-Git
https://git-scm.com/book/zh/v2/Git-与其他系统-作为客户端的-Git

install the latest git

yum -y install subversion subversion-perl perl-TermReadKey curl-devel expat-devel gettext-devel openssl-devel zlib-devel asciidoc xmlto docbook2x docbook2X
wget https://www.kernel.org/pub/software/scm/git/git-2.7.3.tar.gz
tar xvf git-2.7.3.tar.gz
cd git-2.7.3
make configure
./configure --prefix=/usr/local/git2.7.3
make -j8 all doc info
ln -s /usr/local/git2.7.3/bin/git /usr/bin/
vim ~/.subversion/servers
# let store-passwords = yes
git svn clone --username dev https://svn.yourdomain.com/yourrepo
cd yourrepo
# 首次 first time
git branch -a
git show-ref
# push to gitlab server
git remote add origin ssh://[email protected]/svn/yourrepo.git
git push -u origin master
# 更新 update
git svn fetch && git svn rebase
git push