6

Our company uses (and supports!) SVN, but I tend to use git. What I want to try is to have git repository - one per project, project developers will be able to pull from this repository (and of course pull from each other if they will want to). But I still want to push all the changes to the SVN, because SVN is being maintained by our tech-support.

I was testing the scenario with following repositories:

  1. SVN-repository - this one is maintained by our company and our team should push all changes there at some point
  2. git-svn-clone - this is git repository cloned from SVN above - all project developers should push their commits here
  3. git-dev-clone - this is developer's git repository.

The only issue with straightforward usage of 'git svn rebase' and 'git svn dcommit' that I've noticed is that after each push from developer's git repository to the git-svn-clone repository I have to rebase developer's repository as soon as changes will be propagated to SVN and rebased. What I want to achieve is to avoid rebasing after each push.

Please note that I'm assuming that every project developer will use only git repository and nobody will use SVN directly.

I was able to achieve this behavior manually by checking out every git commit one by one in 'git-svn-clone' repository after push and committing those changes to the SVN using SVN client. I believe that 'git svn dcommit' does the same but it also syncs back from SVN and changes commit SHA identifiers which forces me to rebase.

P.S.: --no-rebase option for git svn dcommit didn't help since after first commit propagated to SVN git svn dcommit didn't allow me committing more changes to the SVN until previous one was rebased. I've tried this behavior once and probably could overlook something.

0

2 Answers 2

7

It's actually even worse than that... dcommit changes the commits uploaded to SVN (adding git-svn-id lines, changing the authorship information, etc.) even if you hacked dcommit to not try to rebase.

Basically, git-svn is not able to sync back from SVN ever without doing rebases. A new git<->SVN interface that might remove this limitation is being worked on, but it's not ready yet.

I'm afraid that if you want to keep in sync with the SVN repository, your scenario will not work without rebasing right now.

Sign up to request clarification or add additional context in comments.

3 Comments

Regarding not being able to 'sync back from SVN ever without doing rebases'. I'm OK without sync back from SVN, all I need is to sync TO SVN.
In that case you'll still have to do pretty extensive hackery on git-svn, because it uses the information in commit objects for a whole lot of things and so rewrites them during dcommitting.
Thanks, Jan. I also understood that even solving this problem will not let me to do what I want in acceptable manner because of other problems. I would probably start looking on installing Git in our company so it will be available without SVN. Thanks for your answer anyway.
0

This answer implies that using --no-metadata will remove svn information from commit messages. That may make dcommit use the same commits, but I haven't verified:

As an example, if I git svn init a repo from a local file: URL and later pull from an https: URL, every commit in the repo will be duplicated, since all of the commits with git-svn-id: file:///... will be fetched as git-svn-id: https:///... and encoded with new SHA1's.

If I specify --no-metadata then the commit message and this sha1 has will be the same and I can fetch from either the local filesystem or the subversion server because there will only be a single copy of any given svn commit in the git repo.

You may also need --authors-file to ensure git and svn user names are exact matches.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.