如何将svn仓库转换为Windows上的git [英] how to convert svn repository to git on Windows

查看:216
本文介绍了如何将svn仓库转换为Windows上的git的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有远程的svn仓库,我们希望它转换成git。
您能否告诉我在Windows上如何做到这一点?
谢谢。

解决方案

在Windows上安装应用程序:

b



  • 调用TortoiseGit克隆对话框



    右键单击目标文件夹,例如 D:\SVN\ToGit ,并点击 Git Clone ...

    < a href =https://i.stack.imgur.com/Btd2R.png =nofollow noreferrer>
    $ b

    检查从SVN存储库复选框 strong>





    如果您先复制网址,然后调用克隆对话框,TortoiseGit将从剪贴板中获取复制的URL并将其粘贴到URL的文本字段中。所以,你不要自己贴。如果你右键点击目标文件夹,TortoiseGit也会填充目录文本字段为你。所以,只需检查从SVN存储库复选框。



    如果svn存储库具有标准布局,比如 trunk,tags,branches ,则不需要做进一步处理。



    点击确定按钮

    然后,开始克隆一个svn存储库到git存储库。

    类似于这样的内容:





    正如您所看到的,TortoiseGit只是正确使用Git for Windows命令 git svn clone 来克隆它。

      git.exe svn clonesvn://svn.code.sf.net/p/tortoisesvn/code/ D:\SVN\ToGit\tsvn-T trunk -b branches -t 

    所以,基本上,你可以进入 Git Bash / CMD 并重新使用该命令行,并获得相同的结果。



    注意:如果您可以看到 r1 r2 r3 ...,您可以随时停止克隆,稍后使用相同的命令行恢复。






    克隆本地svn仓库



    随着TortoiseGit 2.4.4 +



    只需将svn本地路径复制到克隆对话框的URL即可。请参阅:



    同样,检查从SVN仓库复选框



    克隆:



    TortoiseGit 2.4.4 +将使用 file:/// 协议来克隆本地svn仓库。




    获得git仓库后,您可以在那里提交。通过使用 TortoiseGit - > SVN DCommit ... ,类似于 svn commit







    正如你所看到的,命令是 git svn dcommit



    如果源svn仓库有一些新的提交需要更新,使用 TortoiseGit - > SVN Rebase 来获取svn commit并合并/ rebase在最新的承诺。例如 svn update





    它使用 git svn fetch 然后使用 git rebase 合并/重新绑定获取更改。





    对于命令行,你

    阅读 Pro Git v2 - 第9章了解更多信息和示例。


    We have remote svn repository and we want it to convert to git. Could you please tell me how is it possible to do it on Windows? Thank.

    解决方案

    Install application on Windows:

    Find out the svn repository URL and copy it

    Something like this:

    Invoke TortoiseGit Clone dialog

    Right click on destination folder, e.g. D:\SVN\ToGit, and Click Git Clone...

    Check the From SVN repository checkbox

    If you copied the URL first, then invoke the clone dialog, TortoiseGit will get the copied URL from clipboard and paste it into the URL text field for you. So, you don't paste it by yourself. Just have look at it to see if it's correct.

    And if you right click on destination folder, TortoiseGit also fill the Directory text field for you. Also, take a look to see if it's what you want.

    So, just check the From SVN repository checkbox.

    And if the svn repository has the standard layout, say trunk, tags, branches, you don't need to do anything further.

    Click the OK button to go

    Then, starting to clone a svn repository to git repository.
    Something like this:

    As you can see, TortoiseGit just properly uses Git for Windows command git svn clone to clone it.

    git.exe svn clone "svn://svn.code.sf.net/p/tortoisesvn/code/" "D:\SVN\ToGit\tsvn" -T trunk -b branches -t 
    

    So, basically, you can go Git Bash/CMD and re-use that command line, and also get the same result.

    NOTE: If you can see the r1, r2, r3..., you can stop the cloning anytime, and resume it later by using the same command line.


    Clone a local svn repository

    With TortoiseGit 2.4.4+

    Just copy the svn local path into URL of Clone dialog. See:

    Again, Check the From SVN repository checkbox

    Cloning:

    TortoiseGit 2.4.4+ will use file:/// protocol to clone a local svn repository.


    After you get a git repository, you can commit there. And push the commit back to origin svn repository by using TortoiseGit ->SVN DCommit..., something like svn commit.

    As you can see, the command is git svn dcommit.

    And if the origin svn repository has some new commit(s) need to update, you can use TortoiseGit ->SVN Rebase to fetch the svn commit and then merge/rebase on the latest commit. Something like svn update.

    It uses git svn fetch then uses git rebase to merge/rebase the fetched changes.

    For command line, you could just use git svn rebase.


    Read Pro Git v2 - Chapter 9 for more information and examples.

    这篇关于如何将svn仓库转换为Windows上的git的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆