1

We have a project (Visual studio solution actually) which has been checked into a svn repo and a git repo separately. They're "in sync" at the moment but I would like to start using git and git-svn to keep them both up to date.

I've read various guides to git-svn but they either seem to assume you're starting with an existing svn and want to create a new git repo, or import a branch of the svn repo into an existing git repo or similar. None that I've found seem to exactly match this scenario.

What is the best way to get started when both repos already exist?

EDIT:

Just an edit to clear up my intention with this, and where I started:

1) I created an initial git repo and have been working in there. I don't want to lose this as it has the "history" of this solution.

2) I created an svn repo and checked the solution into that, since there are people on my team who are reluctant to learn git.

3) I want to keep working day to day in the git repo (local and remote)

4) Occasionally I want to push the current state of the git repo into the svn repo, but I would like to do this with git-svn or some other method that doesn't require switching between git and svn. The svn repo doesn't have to be completely in sync with the git repo.

So given I have an existing git repo with checkins that I don't want to lose, how do I "hook up" my local git repo to the svn repo for use with git-svn?

This seems to be the reverse of how poeple usually get started with git-svn so most tutorials I've found aren't of much help. I did find this, which looked hopeful, but it doesn't actually seem to work (and there's not much detail in what each step is actually doing, so I'm not sure where it's going wrong)

http://ivanz.com/2009/01/15/selective-import-of-svn-branches-into-a-gitgit-svn-repository/

EDIT2: As I was making the edit above, I realized that what I actually want to do is push an existing git repo into a new svn repo. By googling for this, it looks like this has already been answered, and my question has ended up being a duplicate of this one:

Pushing an existing git repository to SVN

I'll probably delete this question once I've tried and confirmed that approach...

Community
  • 1
  • 1
mutex
  • 7,536
  • 8
  • 45
  • 66
  • The purpose of `git-svn` is to allow users to pick whether they want to use SVN or git for day-to-day operations while still keeping everything in a single (SVN) repository. Trying to keep two repositories in sync is almost sure to generate more problems than it solves. – BJ Myers Mar 08 '16 at 03:51
  • @BJMyers Sorry "in sync" was probably a poor choice of words. What I want to do is use git day to day but occasionally push everything into a SVN repository (because apparently some people hate learning new things :P ) Problem is I created both a remote git repo and an svn repo before reading about git-svn, so now I want to "connect" my local git repository to both the remote git (already done since this is where I started) and SVN repos. The svn repo doesn't need to be completely "in sync" - I just need an easy method to occasionally push the current git state into the SVN repo. – mutex Mar 08 '16 at 04:09
  • Ah, gotcha. You might edit some of that explanation into your question to flesh it out a bit more. I don't have any suggestions for you, but somebody else might. – BJ Myers Mar 08 '16 at 05:49
  • Forget about standalone Git-repo and create new with `git svn clone`? If you want to have minimum frictions... – Lazy Badger Mar 08 '16 at 07:09
  • @LazyBadger - That's my fallback position, but I would prefer not to - see edits in the question for how I got to the current state and why I'd prefer not to. – mutex Mar 08 '16 at 20:20

0 Answers0