简体   繁体   English

来自GIT存储库的svn-checkout

[英]svn-checkout from a GIT repository

Is there a way to make an svn-checkout from a git repository? 有没有办法从git存储库进行svn-checkout?

The problem is that I'd like to have a git repository stored on a server and I can work within using git normally, pushing and pulling changes. 问题是我想在服务器上存储一个git存储库,我可以正常使用git,推送和拉动更改。

However, there are developers, who don't need to make changes in the code, but they need to be able to fetch the latest snapshot of the source code and build it on their machine. 但是,有些开发人员不需要对代码进行更改,但他们需要能够获取源代码的最新快照并在其计算机上构建它。 Those so called "developers" would really like to use SVN as it an SCM they're already familiar with. 那些所谓的“开发人员”真的很想使用SVN作为他们已经熟悉的SCM。

So, is there a way to setup such scenario? 那么,有没有办法设置这样的场景? Or is this the only possible way -- to use an SVN repository and work with it using git-svn if I want git for myself and SVN for the rest of my colleagues? 或者这是唯一可行的方法 - 使用SVN存储库并使用git-svn使用它,如果我想为我自己的git和其他同事的SVN?

Thanks! 谢谢!

If you want to checkout a repository using SVN, you have to have an SVN repository, unsurprisingly. 如果您想使用SVN签出存储库,您必须拥有一个SVN存储库,不出所料。 Without that, it would be hard to keep track of the things that don't translate nicely between SVN and git (eg revision number, branches). 如果没有这个,就很难跟踪SVN和git之间不能很好地转换的东西(例如版本号,分支)。

But what you are asking for doesn't really seem like a repository, you just need to synchronize a folder. 但是你所要求的并不像是一个存储库,你只需要同步一个文件夹。 For that, other tools than SVN are probably better suited, eg rsync . 为此,除了SVN之外的其他工具可能更适合,例如rsync Another possibility is to have an always up-to-date archive containing the source code (for example Github provides this). 另一种可能性是拥有一个包含源代码的总是最新的存档(例如Github提供此代码)。

Using an SVN repo through git-svn for you would work, but if there are other people that like git, you will lose the benefits of collaborating with git. 通过git-svn使用SVN repo可以工作,但是如果有其他人喜欢git,你将失去与git协作的好处。 That's what I use at work where SVN is the de facto standard and I just prefer git's commands and better log display. 这就是我在SVN是事实标准的工作中所使用的,我只是更喜欢git的命令和更好的日志显示。 We mostly use SVN as an archiving tool anyway: no branches, and we synchronize in real life to collaborate on a single document. 我们大多使用SVN作为归档工具:没有分支,我们在现实生活中同步以协作处理单个文档。

Another solution would be to make the official repo a git one, and automatically push to a slave svn repo using git-svn , either with cron or in a post-commit hook. 另一个解决方案是使官方repo成为一个git one,并使用git-svn自动推送到slave svn repo,或者使用cron或者在post-commit钩子中。 This seems the best one if as you say, the svn users will never need to commit. 这似乎是最好的,如你所说,svn用户永远不需要提交。

Thank you for your answers, svick and Damien ! 谢谢你的回答, svickDamien They are both good, but as I cannot accept them both, I'm going to some up the whole thing in my own answer. 他们都很好,但由于我不能接受他们两个,我会在我自己的答案中做一些事情。


So, basically, one could have a git repository with read-only svn-access to it. 所以,基本上,可以有一个git存储库, 只有对它的只读 svn访问权限。 As Damien said, 达米恩说,

make the official repo a git one, and automatically push to a slave svn repo using git-svn, either with cron or in a post-commit hook. 使官方repo成为一个git one,并使用git-svn自动推送到slave svn repo,或者使用cron或者在post-commit钩子中。

Another way to get read-only access to the code in any repository is to have an archive with the latest snapshot of the source code stored somewhere on your server and available for download. 获取任何存储库中代码的只读访问权限的另一种方法是使用存储器将源代码的最新快照存储在服务器的某个位置并可供下载。


If there is a need for some users to make changes in the code, the only appropriate way to save them would be to commit them back into the repo, no matter what SCM is used. 如果某些用户需要对代码进行更改,那么保存它们的唯一合适方法是将它们提交回repo,无论使用什么SCM。 In this case, if the user who has made a change doesn't know how to commit, there should be a programmer (responsible for the source code) who will gladly review the change and commit it back into the repo. 在这种情况下,如果进行更改的用户不知道如何提交,则应该有程序员(负责源代码),他们将很乐意查看更改并将其提交回repo。

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

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