开发者

How to use git-svn properly, svn-ers checkout svnrepo and git-ers clone gitrepo, committing carelessly

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...


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.


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜