如何正确使用git-svn,svn-ers checkout svnrepo和git-ers clone gitrepo,不小心提交

发布于 2024-11-30 18:10:23 字数 888 浏览 0 评论 0原文

在我的公司,我们使用 SVN,但希望将来无缝切换到 GIT。这就是我开始学习 git-svn 的原因,它有望作为 svn 存储库的前端。

我尝试通过以下设置使用它:

  • SVNREPO - 主 svn 存储库
  • GITREPO - SVNREPO REPO1、REPO2 的 git-svn 克隆 REPO1
  • 、REPO2、... - 代表 git-ers 的 GITREPO 的 git 克隆

要求是:

  • [ManyGitUsers]< /code> 许多 giters 可以从 GITREPO 克隆/推送到 GITREPO
  • [ManySvnUsers] 许多svners 提交到 SVNREPO
  • [SyncHook] GITREPO 和 SVNREPO 之间的同步可以通过 hook 来完成,或者在开发 hook 之前由管理员手动完成
  • [NoInteraction] giters 不想了解有关 SVNREPO 的任何信息,反之亦然
  • [NoProactivity] 用户在发生问题(冲突)时解决所有问题;他们不与其他人同步以避免它们

问题:

  1. 可以使用 git-svn 进行此设置吗?如果有更好的建议,
  2. 我应该如何配置 GITREPO?
  3. giters 是否需要了解特殊的后端,或者一切都是透明的?

到目前为止,我的实验表明它moreless有效,但是提交到SVNREPO破坏了与git同步的可能性。我只是相信原因是我发出了错误的命令......

In my company we use SVN, but want to seamlessly switch to GIT in future. That's why I started to learn git-svn, which promises to serve as a frontend for svn repository.

I tried to use it with following setup:

  • SVNREPO - the master svn repository
  • GITREPO - git-svn clone of SVNREPO
  • REPO1,REPO2,... - git clones of GITREPO representing git-ers

The requirements are:

  • [ManyGitUsers] many giters can clone from/push to GITREPO
  • [ManySvnUsers] many svners commit to SVNREPO
  • [SyncHook] synchronization between GITREPO and SVNREPO can be done by hook, or manually by admin before the hook is developed
  • [NoInteraction] giters don't want to know anything about SVNREPO and vice versa
  • [NoProactivity] users solve all problems (conflicts) when they happen; they don't sync with others to avoid them

Questions:

  1. Is this setup possible with git-svn ? Suggest other if there is a better one
  2. How should I configure the GITREPO ?
  3. Will giters need to be aware of the special backend, or is everything transparent ?

So far, my experiments showed that it moreless works, but commit into SVNREPO breaks the possibility to synchronize with git. I just believe that the reason is me issuing bad commands...

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

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

发布评论

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

评论(3

猥︴琐丶欲为 2024-12-07 18:10:23

有一个 git-svn 的替代方案可以满足您的需求:SubGit。我正在从事 SubGit 项目,但我希望这个答案是相关的并且不会被视为垃圾邮件。

SubGit 是一个工具,您可以在服务器端将其安装到存储库中。然后,您将能够使用“git clone”克隆该存储库或签出作为 Subversion 工作副本。 Git 用户将像使用普通 Git 存储库一样工作,不需要特殊命令。对于 Subversion 用户来说也是如此。

Git 和 Subversion 端通过 SubGit 自动保持同步。

There is an alternative to git-svn that looks to suite your needs: SubGit. I'm working on SubGit project, but I hope this answer is relevant and would not be considered as a spam.

SubGit is a tool that you install into your repository once on the server side. Then you'll be able to clone that repository using 'git clone' or checkout as a Subversion working copy. Git users will work just as they would work with the ordinary Git repository, no special commands are needed. Same is correct for Subversion users.

Git and Subversion sides are automatically kept in sync by SubGit.

や莫失莫忘 2024-12-07 18:10:23

我认为这从长远来看不会产生问题,并且会引起问题。

首先说一下svn镜像是如何完成的:

通常有一个master repo和一个slave repo(一般在不同的位置,因此有必要)。 svners 在 master 位置签出并从 master 提交。从属位置的那些在从属位置签出并提交。但实际的设置是,每当有人提交到镜像时,从站的提交首先提交到主站,然后镜像回从站(svnsync)。最终用户并不知道这一点。这可以确保存储库同步。有关此设置的更多说明: http://www.tty1.net /blog/2007-08-26-subversion-proxy_en.html

现在,引入Git,就变得困难了。问题是,Git 存储库和 SVN 存储库中的 bot 几乎可以同时提交。如果 SVN 中的提交被应用,并且新的提交来自 Git(它在 SVN 中没有看到新的提交),那么您将遇到很多麻烦。

您可以进行的设置是所有用户都使用 git-svn 直接“克隆”svn 存储库。然后他们可以像任何其他 svn 客户端一样使用 git 存储库。

或者有一个像你提到的中央 git 存储库(使用 git-svn 克隆),所有 giters 都从中克隆并推送到它。有一个从中央存储库连接到 git svn rebase 和 git svn dcommit 的钩子,但是当出现问题时,有人会手动修复存储库。

I don't think this can in long term and will cause problems.

First let me talk about how svn mirroring is done:

Usually, there is a master repo and a slave repo ( at different locations generally, hence the need). The svners, at master location checkout and commit from master. The ones at slave location checkout and commit at slave. But the actual setup is that whenever someone commits to the mirror, the commit at slave is first committed to the master and then mirrored back to slave ( svnsync). The end user is not aware of this. This makes sure that the repos are in sync. More explanation on this setup: http://www.tty1.net/blog/2007-08-26-subversion-proxy_en.html

Now, bring in Git, it becomes difficult. The thing is, there can be near simultaneous commits in bot the Git repo and the SVN repo. If the commit in SVN gets applied and the new commit comes in from Git ( which had not seen the new commit in SVN), you will be in whole lot of trouble.

The setup you can have is that all the users use git-svn to "clone" the svn repo directly. They can then use the git repo like any other svn client.

Or there is a central git repo like you mentioned ( clone with git-svn) and all the giters clone from it and push to it. There is a hook to git svn rebase and git svn dcommit from the central repo, but when things break, some one manually fixes the repo.

失与倦" 2024-12-07 18:10:23

有用。搜索/阅读文档。还有大量的书籍涵盖了这一点。

基本上,GIT 用户承担所有责任,SVN 方面的所有内容都保持不变。

每次 SVN 提交时,GIT 用户都必须执行 git svn rebase。每次 GIT 提交时,GIT 用户都必须执行 git svn dcommit。

It works. Search / Read the documentation. Also there are tons of books that cover this.

Basically the GIT users have all the responsibiliy and everything on SVN side stays the same.

On every SVN commit GIT users have to do git svn rebase. On every GIT commit GIT users have to do git svn dcommit.

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