当使用git-svn或svn2git从svn转换为git时,如何更改存储库的基本路径并可能仍然保留分支/标记? [英] When converting from svn to git using git-svn or svn2git, how can I change the base path of the repository and possibly still keep branches/tags?

查看:119
本文介绍了当使用git-svn或svn2git从svn转换为git时,如何更改存储库的基本路径并可能仍然保留分支/标记?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将一个项目从SVN转移到git(完全不需要git svn的SVN互操作功能),并且我试过使用 git svn svn2git nirvdrum在github上分享 ),我遇到的一个问题是,我们在SVN中的版本库布局就像这样:

example.com/website/trunk | branches | tags / base / code



等等,当我将它导入到git中时,存储库的根目录包含一个目录base真名),然后是所有的东西。这对我们来说是一个问题,因为它增加了一些复杂性。



是否有一种简单易用的方法可以将存储库的根目录更改为基础在进口过程中还是追溯到Git的疯狂历史改变的权力?否则,一个不应该是版本库根目录并包含其他不相关代码的目录必须是git中版本库的根目录,这很奇怪,由于某种原因,对于SVN,情况并非如此(即根目录是基地,父目录没有任何svn的东西)。

希望这是一个简单的问题,有人可以轻松回答。



哦,顺便说一句,我确实有一些我想要导入的分支和标签,但是这些都应该植根于base,而不是base的父目录。如果这些东西不可能像这样被导入,这并不是什么大事,因为它们几乎没用,而且团队之前只是半心半意地使用SVN,但是拥有它们会很好。

解决方案

svn2git 使用查尔斯答案中的例子:

  svn2git --trunk example.com/website/trunk/base/code \ 
--tags example.com/website/tags/base/code \
--branches example.com/website/branches/base/code



<注意:我没有试过这个,但据我所知, svn2git 只需将 -T | t | b 选项转换为 git-svn 。]


I'm moving a project from SVN to git (completely, so no need for git svn's SVN interop features) and I've tried using both git svn and svn2git (nirvdrum's fork on github) and one problem I've got is that our repository layout in SVN was like so:

example.com/website/trunk|branches|tags/base/code,

and so when I import it into git, the root directory of the repository contains one directory, base (not the real name) and then all the stuff. This is kind of a problem for us, as it adds a few complications.

Is there a good and easy way to change the root of the repository to be base, either during the import or retroactively with git's mad history-changing powers? Otherwise, a directory that shouldn't be the root of the repository and contains other unrelated code will have to be the root of the repository in git, which is strange, and for some reason, with SVN this was not the case (i.e. the root of the repository was base, and the parent directory did not have any svn stuff).

Hopefully this is a quick question that someone can answer easily.

Oh, by the way, I do sort of have branches and tags I want to import, but again these should be rooted at base, not the parent directory of base. It's not a biggie if these aren't possible to be imported like that because they are pretty much useless and the team was kind of half-heartedly using SVN before, but it would be nice to have them.

解决方案

svn2git takes options for that as well; using the example in Charles' answer it would be:

svn2git --trunk example.com/website/trunk/base/code \
        --tags example.com/website/tags/base/code \
        --branches example.com/website/branches/base/code

[Caveat: I haven't tried this, but as far as I know, svn2git just converts those into the -T|t|b options for git-svn.]

这篇关于当使用git-svn或svn2git从svn转换为git时,如何更改存储库的基本路径并可能仍然保留分支/标记?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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