简体   繁体   English

将 Subversion 存储库导入 Git

[英]Import Subversion repository into Git

I have an existing SVN repository at http://svn.donnael.com/lilypond/SousaFairest .我在http://svn.donnael.com/lilypond/SousaFairest有一个现有的 SVN 存储库。 Out of curiosity, I created a repository at https://github.com/SarekOfVulcan/donnael-Scores as well, and added some files to it.出于好奇,我也在https://github.com/SarekOfVulcan/donnael-Scores创建了一个存储库,并向其中添加了一些文件。 Can I now take the Sousa folder and import that into the GitHub directory, maintaining the change history, or is that more trouble than it's worth?我现在可以使用 Sousa 文件夹并将其导入 GitHub 目录,维护更改历史记录,还是这比它的价值更麻烦? (I have a decent understanding of svn, but git is brand new to me.) (我对 svn 有相当的了解,但 git 对我来说是全新的。)

I believe that would be possible.我相信这是可能的。 There may be a way to do it all from one local repo, but I'm pretty confident that this would work.可能有一种方法可以从一个本地存储库中完成这一切,但我非常有信心这会奏效。 Assuming you're starting from scratch with no local repos:假设您从头开始,没有本地存储库:

  • git svn clone your SVN repo to a local git repo (hereafter known as svn-repo) git svn clone您的 SVN 存储库克隆到本地 git 存储库(后称为存储库)
  • git clone your github repo to a local repo (known as github-repo) git clone您的 github 存储库克隆到本地存储库(称为 github-repo)
  • In github-repo, git remote add svn-repo <url> using a local file URL在 github-repo 中, git remote add svn-repo <url>使用本地文件 URL
  • git fetch svn-repo
  • git merge svn-repo/master to merge the master branch of svn-repo into github-repo git merge svn-repo/master的master分支合并到github-repo
  • Then just push to github然后直接推送到 github

There are many tutorials online about importing subversion into git.网上有很多关于将subversion导入git的教程。 As far as it being a hassle, it's only (3-4 commands).就麻烦而言,它只是(3-4个命令)。 It's worth doing, unless you don't want to keep your svn repo's history.这是值得的,除非你不想保留你的 svn repo 的历史。

Here's githubs guide to pulling it off这是githubs指南

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM