有关使用 TortoiseGit 与 SVN 存储库交互的说明?
多年来,我一直在 Windows 上使用 TortoiseSVN,为我自己的项目提供本地文件系统存储库。我计划开始与一位朋友合作开发其中一个项目,并将存储库转移到我自己的网站上。我读过很多“git 击败 SVN!”的文章。过去几年的帖子,我想我至少应该看看到底有什么大惊小怪的。一些研究发现了“git svn”命令,TortoiseGit 声称有一定程度的 git-svn 支持。我喜欢保留 SVN 存储库,并在将它们提交到存储库之前使用 git 进行一些本地提交或分支的想法。 “搁置”命令听起来也很有用。
不幸的是,虽然有很多 CLI git-svn 教程,但没有任何关于 TortoiseGit 的教程(诚然,它似乎仍处于早期开发阶段)。因此,我在尝试弄清楚需要什么工作流程来让这些部分协作时遇到了问题。
我在 D:\Projects\repositories\MyProject 中有一个 SVN 存储库。我创建了 D:\Projects\temp\gittest,并尝试对存储库进行 TortoiseGit“Git 克隆”。从那里开始,我在尝试指示 trunk/branches/tags 文件夹的位置(这只是我的存储库中的标准布局)时遇到了问题。只有当我不检查这些结果时,我才能获得有用的结果。当我似乎正确启动 git 存储库时,我能够进行一些更改并执行几次 git 提交,但随后在执行 SVN DCommit 时遇到问题。
因此,我希望有人能够提供一套相当详细的说明,说明如何正确使用 TortoiseGit 与现有 SVN 存储库(存储库位于本地文件系统或远程服务器上)。不“不要使用 SVN!”请回复 - 我有兴趣学习如何让这两部分协同工作。如果您觉得 TortoiseGit 的 SVN 支持还不够成熟,无法完成这项工作,那么这也将是有用的信息。
谢谢!
I've been using TortoiseSVN on Windows for years with local filesystem repositories for my own projects. I'm planning to start collaborating with a friend on one of the projects, and will be shifting the repository to my own website. I've read a lot of "git beats SVN!" posts over the last couple years, and figured I ought to at least see what the fuss was about. Some research turned up the "git svn" command, and that TortoiseGit claims to have some level of git-svn support. I like the idea of keeping the SVN repository, and doing some local commits or branches with git before committing them to the repository. The "shelve" command also sounds useful.
Unfortunately, while there's a number of CLI git-svn tutorials, there's nothing for TortoiseGit (which admittedly seems to be still in early development). As a result, I'm having problems trying to figure out what workflow I need to get these pieces to cooperate.
I have an SVN repository in D:\Projects\repositories\MyProject. I created D:\Projects\temp\gittest, and tried to do a TortoiseGit "Git Clone" of the repository. From there, I've had issues trying to indicate the location of the trunk/branches/tags folders (which are just the standard layout in my repository). I was only able to get useful results when I left those unchecked. When I did seem to get the git repository started correctly, I was able to make some changes and do a couple git commits, but then had problems doing an SVN DCommit.
So, I'm hoping someone out there can provide a reasonably detailed set of instructions on how to correctly use TortoiseGit with an existing SVN repository (with the repository on either the local filesystem or on a remote server). No "don't use SVN!" responses, please - I'm interested in learning how to get these two pieces to work together. If you feel TortoiseGit's SVN support isn't mature enough to make this work, that would also be useful information.
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(8)
现在这可能是显而易见的,但 tortoisegit 现在内置了对 git-svn 的支持。
This is probably obvious now, but tortoisegit now has built-in support for git-svn.
更新:我坚持对所写问题的回答(“我打算开始与朋友合作......”),但如果你确实想要/需要保留 Subversion,我更喜欢我的 git-svn 工作流程。
git-svn 存在的唯一原因是允许将 Git 与现有的 Subversion 基础设施一起使用。由于您基本上没有基础设施,因此绝对没有理由不完全切换到 Git。 git-svn 比 svn 更好,但如果可能的话应该避免使用。
我强烈建议你 git svn clone -s --no-metadata然后忘记你曾经有过 svn。
Update: I stand by my answer to the question as written ("I'm planning to start collaborating with a friend..."), but if you do want/need to keep Subversion I rather liked my git-svn workflow.
The only reason git-svn exists is to allow the use of Git alongside an existing Subversion infrastructure. Since you essentially have no infrastructure, there is absolutely no reason not to just switch to Git completely. git-svn is better than svn, but should be avoided if at all possible.
I would strongly urge you to
git svn clone -s --no-metadata <path_to_svn>
then forget you ever had svn.之前已经注意到了 - 只是把它放在这里作为一个正确的答案:)
TortoiseGit 现在已经内置了对 SVN 的支持,所以它应该可以正常工作。
It has been noted before - just putting it here as a proper answer :)
TortoiseGit now has baked-in support for SVN, so it should work fine.
我使用了 http://msysgit.github.com/ 中的 msysgit,这样我就可以从 subversion 存储库中提取需要接受安全证书和其他命令提示符选项。一旦代码被拉出,我就可以使用 TortoiseGit 来实现大部分功能(除了 svn Push AFAIR)
I used msysgit from http://msysgit.github.com/ so that I can pull from the subversion repository which requires accepting security certificate and other command prompt options. Once the code has been pulled I have been able to use TortoiseGit for most of the functionality (except for the svn push AFAIR)
您可以尝试使用没有集成 SVN 支持的 TortoiseGit,而不是作为普通的 Git 客户端。要实现此功能,您可以将 SubGit 安装到 SVN 存储库中。
下面我列出了如何设置 SubGit 的一些基本说明:
安装后,您可以在 SVN_REPOS/.git 中找到 Git 存储库,并像使用普通 Git 存储库一样使用它。 TortoiseGit 执行的每个 git Push 都会触发预接收和后接收挂钩,将传入的修改复制到 SVN 存储库中。
有关更多详细信息,请参阅 SubGit 文档 和 git-svn 比较页面。
从 2.0 版(发布时尚未发布)开始,SubGit 允许同步位于不同主机上的 Subversion 和 Git 存储库。
SubGit 是一种商业工具,但对于最多 10 名提交者的存储库以及开源和学术项目来说,它是免费的。
免责声明:我是 SubGit 开发人员之一。
You can try to use TortoiseGit with no integrated SVN support rather as a usual Git client. To make this work you can install SubGit into SVN repository.
Below I've listed some basic instructions how to setup SubGit:
After installation you can find Git repository at SVN_REPOS/.git and work with it as with normal Git repository. Every
git push
performed by TortoiseGit triggers pre-receive and post-receive hooks that replicate incoming modifications into SVN repository.For more details please refer to SubGit documentation and git-svn comparison page.
Starting from version 2.0 (not yet released at the moment of posting) SubGit allows to synchronize Subversion and Git repositories located on different hosts.
SubGit is a commercial tool, but it is free for repositories with up to 10 committers and for open-source and academic projects.
Disclaimer: I'm one of SubGit developers.
也许你可以将你的项目放到支持 svn 访问 的 github 上。因此您可以继续使用 TortoiseSVN 并与其他人协作。另一方面,您可以使用诸如 sourceforge 等工具通过 SVN 而不是 git 进行协作。顺便说一句,为什么不使用 git svn clone URLOfTheSVNRepos 并稍后执行 git 提交。
May be you can put your projects to github which supports an svn access. So you can continue to use TortoiseSVN and collaborate with others. On the other hand you can use things like sourceforge etc. to collaborate via SVN instead of git. BTW why not using git svn clone URLOfTheSVNRepos and later do git commits instead.
仅供记录:SourceTree for Windows 计划从 1.4 版本开始支持 git-svn(和 hgsubversion)。相应的问题是 SRCTREEWIN-119。
Just for the record: SourceTree for Windows is planing on supporting git-svn (and hgsubversion) from version 1.4 onwards. The corresponding issue is SRCTREEWIN-119.