3

i have to use a subversion repository and i'd like to use git-svn. I switch the computer sometimes and at the moment i need to commit my changes and update the other computer. Sometimes the changed code wouldn't work, so my idea would be to create two git-svn repos and synchronize them with push/pull, and sometimes sync them (or one of them) with the svn repository. Would that be possible? Switching the repository to git is no option. (Sadly)

John Smith
  • 374
  • 2
  • 11

2 Answers2

2

If you need to sync with SVN your Git repo from both of your computer, then yes: each repo will be a "git-svn" one.
You create 2 repos, and then create your own set of git branches on top of the git-svn ones.

But you must not merge/push/pull any branch that will be dcommit'ed back to SVN: You need to pay attention to the CAVEATS section of git-svn:

For the sake of simplicity and interoperating with Subversion, it is recommended that all git svn users clone, fetch and dcommit directly from the SVN server, and avoid all git clone/pull/merge/push operations between git repositories and branches. The recommended method of exchanging code between git branches and users is git format-patch and git am, or just 'dcommit’ing to the SVN repository.

Running git merge or git pull is NOT recommended on a branch you plan to dcommit from because Subversion users cannot see any merges you’ve made. Furthermore, if you merge or pull from a git branch that is a mirror of an SVN branch, dcommit may commit to the wrong branch.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • So it says i should only exchange code between the git-svn repos via the svn repo? – John Smith Jul 01 '11 at 12:08
  • uhm, the other way would then be to have only one git-svn repo with at least one non-svn branch wich could be pushed/pulled from the other machine. But in this way i could only dcommit from the one git-svn, right? – John Smith Jul 01 '11 at 12:13
  • @John: you could still `dcommit` from both `git svn` branches provided you carefully update those same branch first. – VonC Jul 01 '11 at 12:17
  • meaning i have to do a git-svn rebase first? – John Smith Jul 01 '11 at 12:32
  • 1
    @John: exactly (that reminds me of http://stackoverflow.com/questions/2959443/why-is-the-meaning-of-ours-and-theirs-reversed-with-git-svn/2960751#2960751). – VonC Jul 01 '11 at 12:35
2

I would say rsync the two repos across the two machines. You would have the same repo.

manojlds
  • 290,304
  • 63
  • 469
  • 417
  • So i'd basically have one repo which is rsynced between the machines, right? Would two different os be a problem? (XP <--> Linux) – John Smith Jul 01 '11 at 12:03
  • @John Smith - No that should not be a problem, just make sure the CRLF settings are fine. – manojlds Jul 01 '11 at 12:45