The company decided to switch to github, so the problem today is to merge the two subversion repositories into a github repository. Subversion is easy to convert to git. the svn2git script is recommended for github. On the official website, I wrote a detailed installation method as follows: $ sudo... the company decided to switch to github. so the problem today is to merge the two subversion repositories into a github repository.
Subversion is easy to convert to git. the svn2git script is recommended for github. Detailed installation methods are provided on the official website as follows:
$ sudo apt-get install git-core git-svn ruby rubygems$ sudo gem install svn2git
Create two subdirectories to store the converted two subversion repositories:
$ mkdir tmp && cd tmp $ mkdir projectA projectB
Start conversion:
[Charlee @ ubuntu :~ /Tmp] $ cd projectA [charlee @ ubuntu :~ /Tmp/projectA] $ svn2git http://svn.example.com/projectA # because it is a standard directory structure, you do not need to specify the trunk branch [charlee @ ubuntu :~ /Tmp/projectA] $ cd ../projectB [charlee @ ubuntu :~ /Tmp/projectB] $ svn2git http://svn.example.com/projectb?charlee@ubuntu :~ /Tmp] $ cd ..
In this way, the two git repositories projectA and projectB are obtained. Next, use the git-stitch-repo mentioned in stackoverflow to merge the two repositories into one. First install git-stitch-repo:
$ tar xzvf Git-FastExport-0.07.tar.gz$ make$ sudo make install[charlee@ubuntu:~/tmp]$ git clone https://github.com/charlee/project.git[charlee@ubuntu:~/tmp]$ cd project[charlee@ubuntu:~/tmp/project]$ git-stitch-repo ../projectA:projectA ../proejctB:projectB | git fast-import[charlee@ubuntu:~/tmp/project]$ git checkout master-A[charlee@ubuntu:~/tmp/project]$ git checkout master-B[charlee@ubuntu:~/tmp/project]$ git checkout master[charlee@ubuntu:~/tmp/project]$ git branch -d master-A master-B
Then they are thrown to github:
$ git push -u origin master
Success.