Convert subversion to git and merge git repositories

Source: Internet
Author: User
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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.