从 Subversion 迁移到 Git

发布于 2024-09-06 22:26:41 字数 420 浏览 2 评论 0原文

我在几个不同的 Subversion 存储库中有很多预先存在的项目和代码。 我计划通过将一些更容易/即将成为多开发人员的项目迁移到 Git 来尝试使用 Git。 我有几个问题:

  1. 如果我从托管 Git 开始 解决方案,很难改变吗 项目的Git服务器(在 颠覆,你只需要 更改 URL 等)?我会做 这是为了启动并运行 以前对 Git 很熟悉 在本地安装和维护我自己的服务器。

  2. 有哪些值得遵循的好步骤 从 Subversion 迁移我的数据 到 Git?我需要去看看吗 来自 SVN、导出和的每个修订 提交到 Git 来获取历史记录?

  3. 您遇到过任何问题吗?

做出改变的几个原因:我们做了很多分支和合并,我们将在这些项目上添加一些开发人员,我们的开发人员并不总是在办公室/网络上/等等。

I have a lot of pre-existing projects and code in a few different Subversion repositories.
I am planning on getting my toes wet with Git by migrating a few of the easier/soon to be multi-developer projects to Git.
I have a few questions:

  1. If I start with a hosted Git
    solution, is it hard to change the
    Git server of a project (In
    Subversion, you simply have to
    change the URL, etc)? I would do
    this to get up and running and
    comfortable with Git before
    installing and maintaining my own server locally.

  2. What are some good steps to follow
    to migrate my data from Subversion
    to Git? Will I have to check out
    every revision from SVN, export, and
    commit to Git to get the history?

  3. Any gotchas that you've experienced?

A few reasons for the change: We do a LOT of branching and merging, we will be adding a few developers on these projects, we will have developers not always in the office/on the network/etc.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

只是我以为 2024-09-13 22:26:41

1.实际上更改服务器非常容易,因为您将整个存储库克隆到计算机上,然后只需将其推送到新服务器即可;

2.您可以使用git-svn将svn存储库克隆到新的git存储库中,并保留历史记录。首先,您需要创建一个用户文件,将所有 SVN 用户映射到 GIT 用户。在桌面上创建一个名为“users.txt”的文件。使用以下格式映射用户:

username = Full Name [电子邮件受保护] >

现在运行这些命令:

git-svn init url.to.svn.repository --no-metadata
git config svn.authorsfile ~/Desktop/users.txt
git-svn fetch

第一个命令将目录初始化为 git-svn 混合体,并将源点指向 svn 存储库。标志 --no-metadata 告诉 git 留下所有 svn 详细信息(而不是提交日志)。下一个命令告诉 git 将所有 svn 用户重新映射到 git 用户。最后一个命令实际上执行了获取操作。

1. it is actually very easy to change the server since you clone the entire repository on your computer then you just push it to the new server;

2. you can use git-svn to clone the svn repository in a new git repository preserving the history. First you need to create a users file that maps all your SVN users to your GIT users. Make a file on your Desktop named ‘users.txt’. Map the users using this format:

username = Full Name <[email protected]>

Now run these commands:

git-svn init url.to.svn.repository --no-metadata
git config svn.authorsfile ~/Desktop/users.txt
git-svn fetch

The first command initializes the directory as a git-svn hybrid and points the origin at your svn repository. The flag, --no-metadata, tells git to leave all the svn details behind (not the commit log). The next command tells git to remap all the svn users to git users. The last command actually does the fetching.

聚集的泪 2024-09-13 22:26:41

首先我推荐一本书Pro Git

  1. 一点也不难。你可以做类似的事情

    git Remote add

之类的操作,并且可以同时拥有更多遥控器,并在合并它们并推送到服务器之前从同事获取更改到不同的分支。

  1. 我没有在 svn 中创建更多分支的经验,但对我来说,做类似的事情就足够了

    git svn clone svn-repo

firstly I would recommend book Pro Git

  1. It's not difficult at all. You can do something like

    git remote add

and you can have more remotes at the same time and fetch changes from your coworkers to different branches before you merge them and push to the server.

  1. I have no experiences with more branches in svn but for me was enough to do something like

    git svn clone svn-repo

阳光的暖冬 2024-09-13 22:26:41

1)这很微不足道。 Git 是分布式的。

2)如果你google一下,那里有很多指南,但基本顺序是git svn克隆,然后将所有svn标记分支转换为真正的git标记,删除标记分支,然后添加git远程并推送。

3)没什么大不了的。

我强烈建议您使用 GitHub 作为您的主机。他们有私人回购,价格不贵,而且他们的网站很棒。

1) It's trivial. Git is distributed.

2) There's many guides out there if you google, but the basic sequence is git svn clone, then convert all svn tag branches to real git tags, delete the tag branches, then add a git remote and push.

3) Nothing major.

I highly recommend going with GitHub for your host. They have private repos that are not expensive and their site is superb.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文