1

I am a bit lost on what is the correct workflow for the following scenario. I'm using an open source project that's hosted on google code in a subversion repo. I prefer to use git so I've used git-svn to clone the svn repo to a git repo. The original author still commits to the svn repo (yay!) and me and my team commit to the git repo.

I need to be able to - Clone the git repo (that contains the svn history) - Configure git so that it can fetch from the svn repository - configure git-svn so that it fetches from a particular revision number

Note: when you clone the git repo all links to svn are lost.

roundcrisis
  • 17,276
  • 14
  • 60
  • 92
  • How do you intend to deal with conflicts arising from SVN commits? – krlmlr Jun 25 '13 at 08:49
  • I still don't get it. Are the SVN clients forced to work with their "old" code and commit to it, or would you be happy with bidirectional synchronization? – krlmlr Jun 25 '13 at 11:31

2 Answers2

2

SubGit could be an option, they promise a bidirectional Git<->SVN mirror that includes all SVN features. Free for open source projects. Sounds interesting, but I haven't tried this one yet.

Also, GitHub has a bidirectional SVN connector with about the same set of features as SubGit. You can simply check out a Git URL using Subversion, and it works out of the box. This will require a one-time migration from SVN to Git. See also: How to migrate SVN repository with history to a new Git repository?

If neither is an option for you, the safest bet would be probably to git svn clone for each client separately. If authentication is not part of the URL, you can always deploy a cloned GitSVN working copy to a different machine, but this is about it in terms of workflow... Related: git clone of git-svn tree?

(I am not affiliated with any of the companies listed above.)

Community
  • 1
  • 1
krlmlr
  • 25,056
  • 14
  • 120
  • 217
  • thanks for answering. tho to be honest I don't think any of these tools solve the problem I have explained above – roundcrisis Jun 25 '13 at 08:44
  • @Miau: Then it seems that I was unable to understand your problem in the first place. – krlmlr Jun 25 '13 at 08:47
  • Thanks again for the response. I see now that I didn't explain that the migration to git happened already, so that leaves svn connector out. I've been using git-svn to pull the changes from svn to the git repo, but everytime I need to do this from a new machine the process is painful and or hard to repro. I am checkign out subgit to see that it does what I need I just think I dont know git and git-svn well enough. I imagine I need some command that looks like git svn attach-svn-repo (so that after you clone the git repo you can say you can now git svn fetch from the aforementioned repo) – roundcrisis Jun 25 '13 at 08:58
  • @Miau: The GitHub hosted repo will be painless, given that you have already migrated to Git. Only that all your SVN users will need a fresh checkout. But you haven't commented if this is an option for you. – krlmlr Jun 25 '13 at 09:04
  • I have already hosted the repo on github, the problem is how do you fetch from svn and from git after you did that – roundcrisis Jun 25 '13 at 09:06
  • @Miau: Don't underestimate GitHub. Just try: `svn checkout https://github.com/krlmlr/kimisc.git/trunk kimisc` (one of my repos). Of course, commits will only work if I grant you access, but you can also try on a repo of your own. – krlmlr Jun 25 '13 at 09:12
0

ok so I found a way to do this

first add the svn repo to git config file like this

 [svn-remote "svn"]
    url = http://url/to/repo/svn/trunk
    fetch = :refs/remotes/git-svn

Note: if your git repo is what used to be the trunk make sure you include it in the url

then call git svn fetch with the svn (after the fetch) is the name of the svn-remote and -r832 stands for -r (revision) and 832 is the subversion revision number that we want to start from

git svn fetch svn -r832

After that I called git svn rebase and rebased all the picks at the end of it I got a message saying that I should probably create a branch due to all the changes that were rebased and I did then I switched to master and merged the changes from that just created branch. Now I can git svn fetch from that repo :D

If there is a better/shorter way than this, would be great to hear it :)

roundcrisis
  • 17,276
  • 14
  • 60
  • 92