tags:

views:

173

answers:

3

I use Versions on OS X to manage all my code in Subversion. I'm not interested in significantly changing my current workflow until Git has a great GUI app like Versions.

One of my clients wants me to push my code to a private GitHub repository. There are many questions and articles about running Git locally and pushing to a remote Subversion server, but I can't seem to find any suggestions for the opposite scenario.

To be clear, what I want to do is:

  1. Keep my code managed in a local Subversion checkout (the central repository is actually on a remote server, but I'm hoping that doesn't matter here)
  2. Whenever I make a delivery to the client, I'd like to run a command such as "git update-github-with-local-svn-changes"
  3. If someone else commits to GitHub (rare), I'd like to run a command such as "git update-local-svn-with-github-changes"
A: 

There is a git-to-svn bridge called appropriately enough git-svn which allows one to use Git locally and then push/pull to a remote SVN server. But I am not aware of a tool that supports the opposite direction. I am sure I will learn of one in the answers to this question!

Cody Caughlan
Yea, exactly, all the talk about git-svn is great, but it seems to drown out any talk of the opposite direction.
davidcann
+1  A: 

The best answer I can think of is to use git-svn to make a git copy of your subversion server, then push the branch thus created to github. When changes are made in github, pull them down, merge them with your branch cloned from subversion and commit them into subversion. This is treating the whole github side of things as a downstream from your (master) subversion server, and you should be able to use all the suggestions already out there for managing it.

If there is already code in github, you may have to do a bit of dancing with rebasing. The basic idea would be to get the latest source, import it into subversion, pull from subversion using git-svn then rebase the latest git-svn commit on top of the branch from github. You then have the git history with a new commit at the head, containing git-svn metadata. I've not tried this, though.

Andrew Aylett
Thanks, Andrew. I can start a fresh GitHub repository for this project, so the second part shouldn't be an issue.Am I correct in thinking that I should use the "git-svn rebase" command to update my local Git repository with the latest Subversion changes?
davidcann
Thanks, Andrew. This ended up being a good solution.
davidcann
That's probably the easiest way, yes. You could instead use `git svn fetch` and deal with any merging or rebasing yourself.
Andrew Aylett
A: 

Have you tried GitX. It might be good enough of a GUI for git, that you could just go straight with git.

Geoff Reedy
Thanks, Geoff, I've tried GitX and it didn't really fit for me.
davidcann