Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to migrate SVN to Git under Linux

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains "how to migrate SVN to Git under Linux". The content in the article is simple and clear and easy to learn and understand. Please follow the editor's train of thought to study and learn "how to migrate SVN to Git under Linux".

1. Physical environment

Git-server Centos5.8 192.168.1.245Svn-server Centos5.8 192.168.1.108

two。 Establish a mapping file for SVN users to git users

Establish a mapping file for SVN users to git users in the following format:

Cat / tmp/userinfo.txtdavid=sfzhangyanni=yanni

3. Clone a git version library

Clone a git version library through git svn clone, which contains trunk,branches and tags in SVN.

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: prevent git from exporting some useless information contained in SVN-authors-file: SVN account is mapped to git account file, and all svn authors need to do mapping parameters-trunkmobile: main development project parameter-branches: branch project,-ignore-refs: does not include the following branch project parameter yanzi: git project name

4. View the history of project submissions

View the history of project submissions through git log, including author, Rizhao, and submission comments, etc.

Cd yanzigit logcommit 3c4907782804096ea3fa3fb5419dcce610e56f1fAuthor: davidDate: Fri May 10 10:27:50 2013 + 0000

5. List all current branches

Cd yanzigit branch- r tags/mobile_1.0.0 tags/mobile_1.0.1 trunk yanziios1.0.1-build-2223-branch-002

6. Manually convert branches branches to tags

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

7. Delete the excess branches

Git branch-r-d tags/mobile_1.0.0Deleted remote branch tags/mobile_1.0.0 (was d50002b). Git branch-r-d tags/mobile_1.0.1Deleted remote branch tags/mobile_1.0.1 (was e7b78a2).

8. List all current branches again

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

9. Set up git repository and initialize version library

Mkdir-p / data/gitdata/yanziios.gitcd / data/gitdata/yanziios.git/git init-- bareInitialized empty Git repository in / data/gitdata/yanziios.git/

10. Change the owner of yanziios.git to git user

Chown git yanziios.git-Rls-l yanziios.git/total 64drwxr-xr-x 2 git root 4096 May 22 12:25 branches-rw-r--r-- 1 git root 66 May 22 12:25 config-rw-r--r-- 1 git root 73 May 22 12:25 description-rw-r--r-- 1 git root 23 May 22 12:25 HEADdrwxr-xr-x 2 git root 4096 May 22 12:25 hooksdrwxr-xr-x 2 git root 4096 May 22 12:25 infodrwxr-xr- X 4 git root 4096 May 22 12:25 objectsdrwxr-xr-x 4 git root 4096 May 22 12:25 refs

11. Add remote git server address

Git remote add origin git@192.168.1.245:/data/gitdata/yanziios.git

twelve。 Push all branch and tag information to the git server

Git push origin master-tags

After that, SVN migrates to Git testing, and a Git server warehouse yanziios.git is cloned with SourceTree tools on the client side. The Graph information, description information (Description), date, author and version number submitted by git users can be seen in the SourceTree graphical interface.

Thank you for reading, the above is the content of "how to migrate SVN to Git under Linux". After the study of this article, I believe you have a deeper understanding of how to migrate SVN to Git under Linux, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report