How SVN data migrates to git

Source: Internet
Author: User
Tags svn

Because of the GIT distributed architecture, which allows users to view, edit, and submit code locally from the GIT server, the company leader now requires that the data above svn be migrated to Git, and that the git svn command can migrate the data from SVN to git.

1. Physical environment

Git-server Centos5.8 192.168.1.245

Svn-server Centos5.8 192.168.1.108

2. Set up the mapping file of SVN user to git user, the file format is as follows:

Cat/tmp/userinfo.txt
david=sfzhang<shifeng_zhang88@163.com>
yanni=yanni<yanni_liu88@163.com>

3. Clone a git version library through git svn clone, and SVN contains trunk,branches and 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

Parameter--no-metadata means to prevent git from exporting some useless information that SVN contains

Parameter--authors-file indicates that the SVN account is mapped to the GIT account file and all SVN authors have to do the mapping

Parameter--trunkmobile represents a master development project

The parameter--branches represents the branched item,--ignore-refs indicates that the following branch item is not included

Parameter Yanzi represents the GIT project name

4. View the history of project submissions through Git log, including author, Sunshine, and submit comment information.

CD Yanzi
git log
commit 3c4907782804096ea3fa3fb5419dcce610e56f1f
author:david <shifeng_ Zhang88@163.com>
Date:   Fri May 10 10:27:50 2013 +0000

5. Tag is branches (branch) in the GIT version library, listing all current branches first.

CD Yanzi
git branch-r
  tags/mobile_1.0.0
  tags/mobile_1.0.1
  Trunk
  yanziios1.0.1-build-2223-branch-002

6. Manually convert the branches branch to tags.

git tag mobile_1.0.0 tags/mobile_1.0.0
git tag mobile_1.0.1 tags/mobile_1.0.1

7. Remove the extra 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. List all the current branches again.

git branch-r
  trunk
  yanziios1.0.1-build-2223-branch-002

9. Create a git warehouse and initialize the version library.

Mkdir-p/data/gitdata/yanziios.git
cd/data/gitdata/yanziios.git/
git init--bare
initialized git Repository in/data/gitdata/yanziios.git/

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.