天天看點

svn遷移到Git

1.克隆 git svn clone svn://192.168.1.236/test(如果有其它需要,可以增加clone參數)

2.git同步svn:   git svn rebase

3.gitlab遠端:git remote add origin [email protected]:root/bmh.git

4.上傳:git push -u origin master

5.有svn更新就繼續git svn rebase,git push

6.cat /home/script/svn-git.py

<code>#!/usr/bin/env python</code>

<code># -*- coding: utf-8 -*-</code>

<code>import</code> <code>os,time</code>

<code>print</code> <code>time.ctime()</code>

<code>dirname </code><code>=</code> <code>os.getcwd()</code>

<code>home </code><code>=</code> <code>r</code><code>'/home/bmh'</code>

<code>if</code> <code>dirname </code><code>is</code> <code>home:</code>

<code>    </code><code>os.system(</code><code>'git svn rebase'</code><code>)</code>

<code>    </code><code>os.system(</code><code>'git push'</code><code>)</code>

<code>else</code><code>:</code>

<code>    </code><code>os.chdir(home)</code>

7.crontab -l

* */3 * * * /usr/bin/python /home/script/svn-git.py &gt;&gt; /var/log/svn-git.log

      本文轉自YU文武貝 51CTO部落格,原文連結:http://blog.51cto.com/linuxerxy/1860207,如需轉載請自行聯系原作者